zero gravity and bouncing bullets

Topics: Developer Forum
Jan 15, 2010 at 11:54 PM

Hi all,

I'm just starting with Farseer. I have some rudimentary questions, which I'm sure have been asked before, but I haven't found the answers so far on the threads here.

I've got balls being shot by a "tank", and there are 4 enclosing walls. Basically I'm looking for zero gravity, so that the balls bounce off the balls perfectly, with no curves. I.e., if a ball is shot exactly horizontally, it should bounce back and forth on the same horizontal line forever.

I also want zero acceleration/deceleration for these balls: When "shot", they should immediately start moving at the desired velocity.

Are these things possible?


Jan 16, 2010 at 12:04 AM

With the current version (2.x): no

We are developing version 3.0 that will have real circles. Right now we use an approximation of a circle and that is what causing the weird bounce effect. You can wait until 3.0 is released or if you are feeling brave, you can use the version that is inside our source control. The engine in itself works, but it is not fully featured right now.

Jan 16, 2010 at 12:14 AM

I'd be glad to test out the pre-3.0 version. Do I just download the last changeset?

Also, I've approximated the zero-gravity, zero-acceleration behavior, by calling ApplyImpulse on the ball with a Vector of X: 250000, Y:0. Why does the X-value of the vector need to be so high in order to get moderately fast movement?



Jan 16, 2010 at 12:32 AM

You can set IgnoreGravity (If I remember correctly) on the bullets in order to make them ignore gravity.

And yes, you just download the latest changeset.

Jan 29, 2010 at 8:25 PM

Hi genbox, I've downloaded the latest source code, but I'm not sure how it relates to version 2.x. I don't see the factories in there (BodyFactory, GeomFactory). Could you very briefly direct me as to how I can migrate my factory-usage to this new version? Or am I supposed to merge the current version with the 2.x version somehow?