private MyVector GetAngularVelocityEnd(MyVector position, TorqueBall ball)
        {
            // The angular velocity is comming out of the z axis.  I need to lay it down onto the XY plane.

            if (ball.AngularVelocity.IsZero)
            {
                return GetVelocityEnd(ball);
            }

            MyVector retVal = ball.AngularVelocity.Clone();

            retVal.RotateAroundAxis(new MyVector(1, 0, 0), Math.PI / 2d);

            double rotateAngle = MyVector.GetAngleBetweenVectors(new MyVector(1, 0, 0), ball.Velocity);
            if (MyVector.Dot(new MyVector(0, 1, 0), ball.Velocity) < 0)
            {
                rotateAngle *= -1;
            }

            retVal.RotateAroundAxis(new MyVector(0, 0, 1), rotateAngle);

            retVal.Add(GetVelocityEnd(position, ball));

            return retVal;
        }
Example #2
0
 /// <summary>
 /// The only reason you would pass in your own guid is when loading a previously saved scene (the token
 /// works good for processing in ram, but when stuff needs to go to file, use the guid)
 /// </summary>
 public BallBlip(Ball ball, CollisionStyle collisionStyle, RadarBlipQual blipQual, long token, Guid objectID)
     : base(ball, collisionStyle, blipQual, token, objectID)
 {
     _ball = ball;
     _torqueBall = ball as TorqueBall;		// if it's not, null will be stored
 }
 private MyVector GetAngularVelocityEnd(TorqueBall ball)
 {
     return GetAngularVelocityEnd(ball.Position, ball);
 }