示例#1
0
		// ----------------------------------------------------------------------------
		// Obstacle Avoidance behavior
		//
		// Returns a steering force to avoid a given obstacle.	The purely lateral
		// steering force will turn our vehicle towards a silhouette edge of the
		// obstacle.  Avoidance is required when (1) the obstacle intersects the
		// vehicle's current path, (2) it is in front of the vehicle, and (3) is
		// within minTimeToCollision seconds of travel at the vehicle's current
		// velocity.  Returns a zero vector value (Vector3::zero) when no avoidance is
		// required.
		//
		// XXX The current (4-23-03) scheme is to dump all the work on the various
		// XXX Obstacle classes, making them provide a "steer vehicle to avoid me"
		// XXX method.	This may well change.
		//
		// XXX 9-12-03: this routine is probably obsolete: its name is too close to
		// XXX the new steerToAvoidObstacles and the arguments are reversed
		// XXX (perhaps there should be another version of steerToAvoidObstacles
		// XXX whose second arg is "const Obstacle& obstacle" just in case we want
		// XXX to avoid a non-grouped obstacle)

	   
		public Vector3 steerToAvoidObstacle ( float minTimeToCollision, Obstacle obstacle)
		{
			Vector3 avoidance = obstacle.steerToAvoid (this, minTimeToCollision);

			return avoidance;
		}
 public Vector3 steerToAvoidObstacle(float minTimeToCollision, Obstacle obstacle)
 {
     return(obstacle.steerToAvoid(this, minTimeToCollision));
 }
示例#3
0
        // ----------------------------------------------------------------------------
        // Obstacle Avoidance behavior
        //
        // Returns a steering force to avoid a given obstacle.	The purely lateral
        // steering force will turn our vehicle towards a silhouette edge of the
        // obstacle.  Avoidance is required when (1) the obstacle intersects the
        // vehicle's current path, (2) it is in front of the vehicle, and (3) is
        // within minTimeToCollision seconds of travel at the vehicle's current
        // velocity.  Returns a zero vector value (Vector3::zero) when no avoidance is
        // required.
        //
        // XXX The current (4-23-03) scheme is to dump all the work on the various
        // XXX Obstacle classes, making them provide a "steer vehicle to avoid me"
        // XXX method.	This may well change.
        //
        // XXX 9-12-03: this routine is probably obsolete: its name is too close to
        // XXX the new steerToAvoidObstacles and the arguments are reversed
        // XXX (perhaps there should be another version of steerToAvoidObstacles
        // XXX whose second arg is "const Obstacle& obstacle" just in case we want
        // XXX to avoid a non-grouped obstacle)


        public Vector3 steerToAvoidObstacle(float minTimeToCollision, Obstacle obstacle)
        {
            Vector3 avoidance = obstacle.steerToAvoid(this, minTimeToCollision);

            return(avoidance);
        }
示例#4
0
		// ----------------------------------------------------------------------------
		// Obstacle Avoidance behavior
		//
		// Returns a steering force to avoid a given obstacle.	The purely lateral
		// steering force will turn our vehicle towards a silhouette edge of the
		// obstacle.  Avoidance is required when (1) the obstacle intersects the
		// vehicle's current path, (2) it is in front of the vehicle, and (3) is
		// within minTimeToCollision seconds of travel at the vehicle's current
		// velocity.  Returns a zero vector value (Vector3::zero) when no avoidance is
		// required.
		//
		// XXX The current (4-23-03) scheme is to dump all the work on the various
		// XXX Obstacle classes, making them provide a "steer vehicle to avoid me"
		// XXX method.	This may well change.
		//
		// XXX 9-12-03: this routine is probably obsolete: its name is too close to
		// XXX the new steerToAvoidObstacles and the arguments are reversed
		// XXX (perhaps there should be another version of steerToAvoidObstacles
		// XXX whose second arg is "const Obstacle& obstacle" just in case we want
		// XXX to avoid a non-grouped obstacle)

	   
		public Vector3 steerToAvoidObstacle ( float minTimeToCollision, Obstacle obstacle)
		{
			Vector3 avoidance = obstacle.steerToAvoid (this, minTimeToCollision);

			// XXX more annotation modularity problems (assumes spherical obstacle)
			if (avoidance != Vector3.zero)
				annotateAvoidObstacle (minTimeToCollision * Speed);

			return avoidance;
		}