This project has moved. For the latest updates, please go here.

Bullet Velocity Question

Topics: User Forum
Jan 11, 2011 at 2:15 PM

Hi guys!

I am a beginner to Farseer Physics, but I have already managed to do some basic stuff. 

Right now I am trying to build a shooter, for better understanding let's say I am trying to build asteroids .

I have set world gravity to (0,0), the player can fly around and face the direction he wants, the fire key creates a new Bullet-fixture with the  same position and rotation as the player.

Bullet looks like this

 class Bullet : FixtureSpriteComponent
        public Bullet(World world)
            : base("Bullet")
            Sprite = new Sprite("images\\bullet");
            Fixture = FixtureFactory.CreateRectangle(world, Sprite.Width, Sprite.Height, 1f);

            Fixture.Body.FixedRotation = true;
            Fixture.Body.BodyType = BodyType.Dynamic;
            Fixture.CollisionFilter.CollisionCategories = Category.Cat2;
            Fixture.CollisionFilter.CollidesWith = ~Category.Cat1;
            Fixture.Body.IsBullet = true;

        public override void Update()
            Fixture.Body.LinearVelocity = Geometry.Radians2Direction(Fixture.Body.Rotation) * 100;



In the Update Method the Body of the Bullet should be forced to fly straight ahead, which it does, but very slow (for a bullet).
I have already tried to change some values here and there but it didn't make any difference.

I hope you could give me a hint : (

Thank you!

Jan 11, 2011 at 3:38 PM

You are using the rotation as the linear velocity? perhaps you should base the speed of the bullet on something else like a fixed speed.

Have you scaled your world to be in meters instead of pixels?

Jan 11, 2011 at 4:29 PM

Thanks for reply!

Nono, thats not the rotation, its a Method that converts the angle (rotation) of the bullet to a small Vector2D - multiplied by a certain value should move the bullet forward.
Sorry for that question but where can I scale the world? x.x cannot find anything like that.. 

Jan 11, 2011 at 4:41 PM

I misread the name of the method.

You need to scale your units from pixels to meters in order for FPE to do it's work correctly. I recommend you search the forums on how to scale or take a look at the samples.

Try changing the Settings.MaxTranslation variable to a higher value. If your bullet moves faster, then you should probably scale your units to between 0.1 and 10 meters.

Jan 12, 2011 at 11:13 AM


Thank you so much Genbox,

i have made some pixel2meter and meter2pixel conversions to meet the 0.1to10m requirement, adjusted the camera a bit and everything looks good!