Return the current cone angle in radians (in [0, pi]) * @return The current half-angle (in radians) of the joint with respect to the cone-limit axis */
| 109 | * @return The current half-angle (in radians) of the joint with respect to the cone-limit axis |
| 110 | */ |
| 111 | decimal BallAndSocketJoint::getConeHalfAngle() const { |
| 112 | |
| 113 | // Get the bodies entities |
| 114 | const Entity body1Entity = mWorld.mJointsComponents.getBody1Entity(mEntity); |
| 115 | const Entity body2Entity = mWorld.mJointsComponents.getBody2Entity(mEntity); |
| 116 | |
| 117 | const Transform& transformBody1 = mWorld.mTransformComponents.getTransform(body1Entity); |
| 118 | const Transform& transformBody2 = mWorld.mTransformComponents.getTransform(body2Entity); |
| 119 | |
| 120 | // Convert local-space cone axis of bodies to world-space |
| 121 | const Vector3 r1Local = mWorld.mBallAndSocketJointsComponents.getLocalAnchorPointBody1(mEntity) - mWorld.mRigidBodyComponents.getCenterOfMassLocal(body1Entity); |
| 122 | const Vector3 r2Local = mWorld.mBallAndSocketJointsComponents.getLocalAnchorPointBody2(mEntity) - mWorld.mRigidBodyComponents.getCenterOfMassLocal(body2Entity); |
| 123 | const Vector3 r1World = transformBody1.getOrientation() * r1Local; |
| 124 | const Vector3 r2World = transformBody2.getOrientation() * r2Local; |
| 125 | |
| 126 | return SolveBallAndSocketJointSystem::computeCurrentConeHalfAngle(r1World.getUnit(), -r2World.getUnit()); |
| 127 | } |
| 128 | |
| 129 | // Reset the limits |
| 130 | void BallAndSocketJoint::resetLimits() { |
nothing calls this directly
no test coverage detected