btVector, rigibody and Nan
Posted: Mon Apr 22, 2019 2:12 am
Hi everyone,
I just installed bullet and messing around with it.
I'm having a strangle problem. when I set up a rigidbody I want the motion state origin to start at the current position of my object. I have a transform class that takes care of all that. Here's the issue, if I set up my motion state like this:
in my update method I check that the position is being affected by gravity:
and indeed it is, starting from 0,0,0 of course.
However, if I set the motion state this way:
In my update method I see that t.getOrigin().getY() result in "-1.#IND", which is Microsoft language for Nan.
Those parameters (x,y,z) from my transform class are all 0. So it works with hard coded values, but not if I pass in parameters.
Anybody else find this strange?
Thanks!
I just installed bullet and messing around with it.
I'm having a strangle problem. when I set up a rigidbody I want the motion state origin to start at the current position of my object. I have a transform class that takes care of all that. Here's the issue, if I set up my motion state like this:
Code: Select all
motionState = new btDefaultMotionState(btTransform(btQuaternion(), btVector3(0,0,0)));
Code: Select all
btTransform t;
btrb->getMotionState()->getWorldTransform(t);
Logger::LogWarning("In update, y is", t.getOrigin().getY());
However, if I set the motion state this way:
Code: Select all
btScalar x = go->transform.GetGlobalPosition().x;
btScalar y = go->transform.GetGlobalPosition().y;
btScalar z = go->transform.GetGlobalPosition().z;
motionState = new btDefaultMotionState(btTransform(btQuaternion(), btVector3(x,y,z)));
Those parameters (x,y,z) from my transform class are all 0. So it works with hard coded values, but not if I pass in parameters.
Anybody else find this strange?
Thanks!