LinearVelocity is limited?

Topics: Developer Forum, User Forum
Apr 7, 2012 at 10:07 PM

Hello guys,

 

I'm try to use LinearVelocity (Body atribute) to move my object (spaceShip) . My game is based in gravity, using LinearSpeed, but, this appears to be limited.

 

My code to move:

 

public static void angleMove(GameObject gameObject)
        {
            float vx = 0;
            float vy = 0;
            if (gameObject.Body.LinearVelocity.X > gameObject.MaxSpeed * -1 && gameObject.Body.LinearVelocity.X < gameObject.MaxSpeed)
                vx = (float)(gameObject.Acceleration * Math.Sin(gameObject.Body.Rotation));
            if (gameObject.Body.LinearVelocity.Y > gameObject.MaxSpeed * -1 && gameObject.Body.LinearVelocity.Y < gameObject.MaxSpeed)
                vy = (float)(gameObject.Acceleration * Math.Cos(gameObject.Body.Rotation)) * -1;
            gameObject.Body.LinearVelocity += new Vector2(vx, vy);

        }

If a variable Vector2 is used to speed up (sum Body.Position and Speed), it works, but, it lost the physics effects (collision)...

 

What can i do to raise my speed using LinearVelocity, my max speed in the code is 300f...

 

Obs: Sorry my english :) Brazilian here