Exemple #1
0
        void RearCollision()
        {
            float bearingAngle = Behaviours.BearingAngle(velocity, neighbor.position - position);
            int[] s;
            // Front
            if (bearingAngle <= 90 || bearingAngle > 270)
            {
                if (debugLog) DebugCollisionType(1);
                s = new []{ 1, 2 };
                if (neighbor.velocity.sqrMagnitude < 1 ) s = new int[] { 1 };
            }

            // Back
            // (bearingAngle > 90 && bearingAngle <= 270)
            else
            {
                if (debugLog) DebugCollisionType(2);
                s = new[] { 1 };
            }

            DetermineStrategy(s);
        }