I am using physx and have a little guy walking around the world (no character controller, just made my own using a bounding box for now and I add impulse to it to walk around)
anyhow, i cant seem to grasp the relationship between the density of the object and the forces needed to make it move. Since the bounding box is relative to the size of the animation file i load, using the same forces on a 4 x 4 x 4 box wont move it the same amount as using that same force on a 2 x 2 x 2 box, but it isnt double either.....
is it normal to use something like Getmass() and calculate a velocity based on that or am I missing something else?
virtual void AddForce(vector3df forceDir, float forceStrength)
{
if (m_NxActor)
{
NxVec3 fd(forceDir.X,forceDir.Y,forceDir.Z);
NxReal fs(forceStrength);
NxVec3 forceVec = fs * fd;
m_NxActor->addForce(forceVec,NX_SMOOTH_IMPULSE,true);
}
}
and when i use the code to move an object, I have to hard code all of the forcestrength until it 'looks right'.
for example,
int Id = CreateObjectByType("CSObject_Ball");
CSObject* o = GetFactory()->GetObjectPointer(Id);
if (o)
{
// get and normalize the direction
vector3df irrDir = (m_Camera->getTarget() - m_Camera->getPosition()).normalize();
o->SetScale(vector3df(10,10,10));
o->SetPosition(m_Camera->getPosition());
o->AddForce(irrDir,5000000);
}
as I scale the object, the density of it causes the mass of it to increase. so a 'ball' of scale(1,1,1) will move massively faster than a ball of size(10,10,10).
has anyone seen any documentation around the net that can help me figure out a formula so that I can move the ball the same speed regardless of the scale of it?
my example :
if i want my character to walk 2 meters per second, what force do I add based upon the total mass of the character?