MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / setTransform

Method setTransform

testbed/common/PhysicsObject.cpp:78–91  ·  view source on GitHub ↗

Reset the transform

Source from the content-addressed store, hash-verified

76
77// Reset the transform
78void 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}

Calls 3

Vector3Class · 0.50
setLinearVelocityMethod · 0.45
setAngularVelocityMethod · 0.45