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

Method notifyRaycastHit

testbed/src/SceneDemo.cpp:687–695  ·  view source on GitHub ↗

Called when a raycast hit occurs (used to move a body with the mouse)

Source from the content-addressed store, hash-verified

685
686// Called when a raycast hit occurs (used to move a body with the mouse)
687rp3d::decimal SceneDemo::notifyRaycastHit(const rp3d::RaycastInfo& raycastInfo) {
688
689 rp3d::RigidBody* body = dynamic_cast<rp3d::RigidBody*>(raycastInfo.body);
690 mMovingBody = body;
691 const rp3d::Transform localToWorldTransform = raycastInfo.collider->getLocalToWorldTransform();
692 mMovingBodyLocalPoint = localToWorldTransform.getInverse() * raycastInfo.worldPoint;
693
694 return raycastInfo.hitFraction;
695}
696
697// Update the engine settings
698void SceneDemo::updateEngineSettings() {

Callers 1

raycastAgainstShapeMethod · 0.45

Calls 2

getInverseMethod · 0.45

Tested by

no test coverage detected