I really can't figure it out, I used Body.Velocity it does work, but it seems buggy. Also I tried to create Controller and use Body.AddBodyForce(), again fail. Does anyone know how to move Body? if you have working code of this, post it, please.
how to move objects?
Started by:
ali (guest)
On: 1258018551|%e %b %Y, %H:%M %Z|agohover
Number of posts: 4
RSS: New posts
On: 1258018551|%e %b %Y, %H:%M %Z|agohover
Number of posts: 4
RSS: New posts
Re: how to move objects?
body.MoveTo(Vector3 position, Matrix orientation);
this should work with a body using collisionskin containing box, sphere, and or capsules
body.MoveTo(Vector3 position, Matrix orientation); isn't a good method for moving characters in real time, this method "teleports" the object, but I need something that will move objects smoothly.
Re: how to move objects?
well it doesnt just teleport. it also wakes up anything resting against it.
if your trying to apply a velocity you might want to make your own body class heres a example based on character body
public class DesiredVelocityBody : Body
{
public Vector3 desiredVelocity;
public override void AddExternalForces(float dt)
{
ClearForces();
Vector3 deltaVel = desiredVelocity - Velocity;
bool running = true;
if (desiredVelocity.LengthSquared() < JigLibX.Math.JiggleMath.Epsilon) running = false;
else deltaVel.Normalize();
deltaVel.Y = 0.0f;
// start fast, slow down slower
if (running) deltaVel *= 10.0f;
else deltaVel *= 2.0f;
float forceFactor = 1000.0f;
AddBodyForce(deltaVel * Mass * dt * forceFactor);
AddGravityToExternalForce();
}
}





