public static SteeringOutput GetSteering(KinematicState ownKS, GameObject attractor, float seekWeight, float wanderRate, float wanderRadius, float wanderOffset, ref float targetOrientation, bool showWhishker, float lookAheadLength, float avoidDistance, float secondaryWhiskerAngle, float secondaryWhiskerRatio, ref bool avoidActive) { // give priority to obstacle avoidance SteeringOutput so = ObstacleAvoidance.GetSteering(ownKS, showWhishker, lookAheadLength, avoidDistance, secondaryWhiskerAngle, secondaryWhiskerRatio); if (so == NULL_STEERING) { if (avoidActive) { // if avoidance was active last frame, update target orientation (otherwise the object would tend to regain // the orientation it had before avoiding a collision which would make it face the obstacle again) targetOrientation = ownKS.orientation; } avoidActive = false; return(WanderAround.GetSteering(ownKS, attractor, seekWeight, ref targetOrientation, wanderRate, wanderRadius, wanderOffset)); } else { avoidActive = true; return(so); } }
protected override SteeringOutput GetSteering() { SteeringOutput result = WanderAround.GetSteering(m_ownKS, m_seekWeight, ref m_wanderInfo, m_seekInfo); base.ApplyFacingPolicy(m_wanderInfo.m_facingPolicy, result); return(result); }
public override SteeringOutput GetSteering() { // no KS? get it if (this.ownKS == null) { this.ownKS = GetComponent <KinematicState>(); } return(WanderAround.GetSteering(ownKS, attractor, seekWeight, ref targetOrientation, wanderRate, wanderRadius, wanderOffset)); }
public static SteeringOutput GetSteering(KinematicState ownKS, float seekWeight, ref SWander wanderInfo, SObstacleAvoidance obstacleInfo, SSeek seekInfo, ref bool obstacleAvoided) { SteeringOutput obstacleAvoidSteering = ObstacleAvoidance.GetSteering(ownKS, obstacleInfo); if (obstacleAvoidSteering != NULL_STEERING) { obstacleAvoided = true; return(obstacleAvoidSteering); } obstacleAvoided = false; return(WanderAround.GetSteering(ownKS, seekWeight, ref wanderInfo, seekInfo)); }
public override SteeringOutput GetSteering() { // no KS? get it if (this.ownKS == null) { this.ownKS = GetComponent <KinematicState>(); } SteeringOutput result = WanderAround.GetSteering(ownKS, attractor, seekWeight, ref targetOrientation, wanderRate, wanderRadius, wanderOffset); base.applyRotationalPolicy(rotationalPolicy, result, attractor); return(result); }