Reset the transform
| 76 | |
| 77 | // Reset the transform |
| 78 | void PhysicsObject::setTransform(const rp3d::Transform& transform) { |
| 79 | |
| 80 | // Reset the transform |
| 81 | mBody->setTransform(transform); |
| 82 | |
| 83 | // Reset the velocity of the rigid body |
| 84 | rp3d::RigidBody* rigidBody = dynamic_cast<rp3d::RigidBody*>(mBody); |
| 85 | if (rigidBody != nullptr) { |
| 86 | rigidBody->setLinearVelocity(rp3d::Vector3(0, 0, 0)); |
| 87 | rigidBody->setAngularVelocity(rp3d::Vector3(0, 0, 0)); |
| 88 | } |
| 89 | |
| 90 | updateTransform(1.0f); |
| 91 | } |