Moving Entities

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Izzo
Posts: 2
Joined: Sun Sep 25, 2011 6:41 pm

Moving Entities

Post by Izzo »

Hi!

I'm working on a game development framework using XNA 4.0 and BEPU physics. My framework supports complex objects based on the entity base class. I'm trying to implement methods like "MoveTo" and "RotateTo" to these objects, where I can define an absolute position and orientation. Now my question is, what's the best way to move an entity? I'm familiar with the "MotorizedGrabSpring" and the "EntityMover", but they have the disadvantage that they don't release the object after it has reached it's position/orientation and I haven't found a "useful" condition yet to release the object manually.

Thanks.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Moving Entities

Post by Norbo »

I'm trying to implement methods like "MoveTo" and "RotateTo" to these objects, where I can define an absolute position and orientation.
The Position, Orientation, and related Entity properties are all settable. Setting Position or Orientation (or OrientationMatrix or WorldTransform...) teleports the object to the value immediately.
Now my question is, what's the best way to move an entity?
If you want to maintain correct collision response, set its velocity related properties like LinearVelocity and AngularVelocity (or equivalently, LinearMomentum and AngularMomentum). Without a velocity to work with, collisions and constraints can't restrict motion properly and are left with 'squishy' position correction alone.

Constraints operate on the velocities of the connected objects as well. The MotorizedGrabSpring is an example of something that uses constraints (SingleEntityLinear/AngularMotors) to control the held object. The EntityMover/EntityRotator use SingleEntityLinear/AngularMotors to control motion of dynamic objects as well. Other than the single entity motors, most constraints operate on two entities to form joints and articulated structures.
they have the disadvantage that they don't release the object after it has reached it's position/orientation and I haven't found a "useful" condition yet to release the object manually.
One possible condition would be to compare the goal position to the current position. If it's under a certain threshold, then look at the velocity. If the velocity is sufficiently low, then releasing the entity would result in it being very close to the goal state.
Post Reply