Dynamic and Keinmatic Objects and Getting it to freeze

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
theneonirvana
Posts: 24
Joined: Wed Aug 17, 2011 9:20 pm

Dynamic and Keinmatic Objects and Getting it to freeze

Post by theneonirvana »

Hi there,
so whenever i create an object i ushally give it a mass to the Entity.

When i dont, the objects are stationary. and prolly using the wrong turn here but Kinematic in the way im thinking
so while they have a mass they should be dynamic

i need to change objects with a mass to stop moving, like a position lock

best way i can figure filtering through the grape vine is letting the physics engine handle it and it will filter down accordingly

ive tried
ObjEntity.BecomeKinematic();

ObjEntity.BecomeKinematic(-1f);

ObjEntity.BecomeKinematic();
((_3D)SelectedObject).ObjEntity.Mass = -1f;
((_3D)SelectedObject).ObjEntity.AngularMomentum = Vector3.Zero;
((_3D)SelectedObject).ObjEntity.AngularVelocity = Vector3.Zero;

Now the object goes stationary but starts dropping at a slow rate due to gravity, and i cant have this happen.

I do not want to remove and recrate and re add the physics entity to the engine i simply should be able to change it,

any help please and thank you?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Dynamic and Keinmatic Objects and Getting it to freeze

Post by Norbo »

Going from dynamic to kinematic preserves velocity. If it was moving at all prior to the transition, it will continue to move. To stop this, set both the linear and angular velocities to zero after making it kinematic.

Code: Select all

ObjEntity.BecomeKinematic();
ObjEntity.LinearVelocity = new Vector3();
ObjEntity.AngularVelocity = new Vector3();
A kinematic entity cannot change its velocity on its own. Kinematic entities do not change velocities in response to collisions or constraints because they have essentially infinite mass. So, once you set the velocities to zero, they will not change unless you tell them to.
Post Reply