Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 5
0
        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);
        }