Zero Gravity Non Increasing Speed From Bounce

Dec 1, 2010 at 7:04 AM

I have about 5 balls bouncing around within a rectangle, each ignoring gravity.  When they collide with anything I want them to not speed up or down after the collision.  I've tried varring the initial values but nothing seems to work well.  So I think I have to use the CollisionHandler to manually set this.  However, I'm at a lost as to what exactly needs to be set.  I obviously want to maintain the new direction after the collision, but, the speed should always be constant.  Need to do the same with rotation as well.

Initially I get everything moving with the following since they are ignoring gravity.  Any help would be appreciated.

_physicsController.PhysicsObjects["phyCirc2"].BodyObject.LinearVelocity = new Vector2(3, 2);

Coordinator
Dec 1, 2010 at 11:42 AM

I'm not sure about a _constant_ speed, but you can limit the velocity and rotation using:

_physicsController.PhysicsObjects["phyCirc2"].BodyObject.LinearDamping

_physicsController.PhysicsObjects["phyCirc2"].BodyObject.AngularDamping

Dec 1, 2010 at 12:24 PM

To disable rotation, you should set PhysicsSprite.FixedRotation = true , object will not rotate. Don't know how to make rotation speed a constant, just started working with Helpers and Farseer Engine.

Dec 1, 2010 at 5:28 PM
AndyBeaulieu wrote:

I'm not sure about a _constant_ speed, but you can limit the velocity and rotation using:

_physicsController.PhysicsObjects["phyCirc2"].BodyObject.LinearDamping

_physicsController.PhysicsObjects["phyCirc2"].BodyObject.AngularDamping

I assume the damping is a "max"?  Is there something similar that I can do for a "minimum"?