change position static object... SOLVED
Posted: Wed Mar 20, 2019 6:17 am
Hi, what would be the best way to change the position of a static object, such as a house when the height of the terrain changes without...
getting this "out of body experience", see pic?
Beside deleting and recreating the static object which obviously works, tried removing, updating the world transform and adding back the rigid
body/collision shape, even getting the object dynamic, then static again.
Only the world transform seems to remain the same, so when I query it, it renders under the collusion shape.
Any ideas, please? Thank you! ))
getting this "out of body experience", see pic?
Beside deleting and recreating the static object which obviously works, tried removing, updating the world transform and adding back the rigid
body/collision shape, even getting the object dynamic, then static again.
Only the world transform seems to remain the same, so when I query it, it renders under the collusion shape.
Any ideas, please? Thank you! ))
Code: Select all
m_dynamicsWorld->removeRigidBody(rigidBody);
btTransform transform;
transform.setIdentity();
transform.setOrigin(btVector3(positionObject.x(), heightTerrain, positionObject.z()));
transform.setRotation(rigidBody->getWorldTransform().getRotation());
rigidBody->setWorldTransform(transform);
m_dynamicsWorld->addRigidBody(rigidBody);