protected override SteeringOutput GetSteering()
        {
            SteeringOutput result = WanderPlusAvoid.GetSteering(m_ownKS, ref m_wanderInfo, m_obstacleAvoidanceInfo, ref obstacleAvoided);

            base.ApplyFacingPolicy(obstacleAvoided ? m_obstacleAvoidanceInfo.m_facingPolicy : m_wanderInfo.m_facingPolicy, result);

            return(result);
        }
Exemple #2
0
        public override SteeringOutput GetSteering()
        {
            // no KS? get it
            if (this.ownKS == null)
            {
                this.ownKS = GetComponent <KinematicState>();
            }

            return(WanderPlusAvoid.GetSteering(this.ownKS, wanderRate, wanderRate, wanderOffset, ref targetOrientation,
                                               showWhisker, lookAheadLength, avoidDistance, secondaryWhiskerAngle, secondaryWhiskerRatio));
        }
        private bool avoidActive = false;          // true if avoidance has been active last frame


        public override SteeringOutput GetSteering()
        {
            // no KS? get it
            if (this.ownKS == null)
            {
                this.ownKS = GetComponent <KinematicState>();
            }

            SteeringOutput result = WanderPlusAvoid.GetSteering(this.ownKS, wanderRate, wanderRate, wanderOffset, ref targetOrientation,
                                                                showWhisker, lookAheadLength, avoidDistance, secondaryWhiskerAngle, secondaryWhiskerRatio, ref avoidActive);

            base.applyRotationalPolicy(rotationalPolicy, result, null);
            return(result);
        }
Exemple #4
0
        public override SteeringOutput GetSteering()
        {
            SteeringOutput result = WanderPlusAvoid.GetSteering(ownKS, wanderRate, wanderRate, wanderOffset, ref targetOrientation, lookAheadLength, avoidDistance, secondaryWhiskerAngle, secondaryWhiskerRatio, ref avoidActive, avoidLayers, scanner);

            if (!surrogateTarget)
            {
                return(null);
            }
            if (ownKS.linearVelocity.magnitude > 0.001f)
            {
                surrogateTarget.transform.rotation = Quaternion.Euler(0, 0, VectorToOrientation(ownKS.linearVelocity));
                SteeringOutput st = Align.GetSteering(ownKS, surrogateTarget);
                result.angularAcceleration = st.angularAcceleration;
                result.angularActive       = st.angularActive;
            }
            else
            {
                result.angularActive = false;
            }

            return(result);
        }