Page 1 of 1

btVector, rigibody and Nan

Posted: Mon Apr 22, 2019 2:12 am
by paolo_x86
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:

Code: Select all

motionState = new btDefaultMotionState(btTransform(btQuaternion(), btVector3(0,0,0)));
in my update method I check that the position is being affected by gravity:

Code: Select all

btTransform t;
	btrb->getMotionState()->getWorldTransform(t);
	Logger::LogWarning("In update, y is", t.getOrigin().getY());
and indeed it is, starting from 0,0,0 of course.

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)));
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!

Re: btVector, rigibody and Nan

Posted: Wed Apr 24, 2019 6:19 am
by steven
it is indeed strange, i think your case needs to debug step by step. i would like to debug with you if you can provide a simple test.