Location of Plane

DestroyerOfCities
Posts: 20
Joined: Fri Dec 10, 2010 3:39 am

Location of Plane

Post by DestroyerOfCities »

I have a weird problem. I am only rendering some boxes on a plane right now (Bullet 2.83). I get the location/orientation of a physics shape like so:

Code: Select all

	rigidBody->getMotionState()->getWorldTransform(bTransform);
	bRotation = bTransform.getRotation();
	bOffset = bTransform.getOrigin();
This works perfectly for boxes, I can throw them all around and they get rendered exactly as the physics dictates. But when I do the same thing for a plane, the offset always comes back as (0.0, 0.0, 0.0). When I created the plane, I set its location as:

Code: Select all

	rigidBody->getWorldTransform().setOrigin(btVector3(0, -1, 0));
And this is where the collision occurs when I throw boxes around. I can move it, and the invisible plane is where I tell it to be. But for rendering, that origin always returns (0.0, 0.0, 0.0) for some reason. In the past I just hardcoded my vertices, as I only have one plane and I didn't care that much. But now I'd like to actually do things right, and I'm wondering why it's working like this?
DestroyerOfCities
Posts: 20
Joined: Fri Dec 10, 2010 3:39 am

Re: Location of Plane

Post by DestroyerOfCities »

Got it. Instead of:

Code: Select all

rigidBody->getMotionState()->getWorldTransform(bTransform);
I needed to do:

Code: Select all

bTransform = rigidBody->getWorldTransform();