btVector, rigibody and Nan

Post Reply
paolo_x86
Posts: 1
Joined: Sun Apr 21, 2019 4:09 am

btVector, rigibody and Nan

Post 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!
steven
Posts: 83
Joined: Mon Nov 05, 2018 8:16 am
Location: China

Re: btVector, rigibody and Nan

Post 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.
Post Reply