diff options
Diffstat (limited to 'modules/bullet/hinge_joint_bullet.cpp')
-rw-r--r-- | modules/bullet/hinge_joint_bullet.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index d3288807b3..ee0d6707d6 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -37,12 +37,20 @@ HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) : JointBullet() { + + Transform scaled_AFrame(frameA.scaled(rbA->get_body_scale())); + scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis); + btTransform btFrameA; - G_TO_B(frameA, btFrameA); + G_TO_B(scaled_AFrame, btFrameA); if (rbB) { + + Transform scaled_BFrame(frameB.scaled(rbB->get_body_scale())); + scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis); + btTransform btFrameB; - G_TO_B(frameB, btFrameB); + G_TO_B(scaled_BFrame, btFrameB); hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB)); } else { @@ -58,14 +66,14 @@ HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, c btVector3 btPivotA; btVector3 btAxisA; - G_TO_B(pivotInA, btPivotA); - G_TO_B(axisInA, btAxisA); + G_TO_B(pivotInA * rbA->get_body_scale(), btPivotA); + G_TO_B(axisInA * rbA->get_body_scale(), btAxisA); if (rbB) { btVector3 btPivotB; btVector3 btAxisB; - G_TO_B(pivotInB, btPivotB); - G_TO_B(axisInB, btAxisB); + G_TO_B(pivotInB * rbB->get_body_scale(), btPivotB); + G_TO_B(axisInB * rbB->get_body_scale(), btAxisB); hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btPivotA, btPivotB, btAxisA, btAxisB)); } else { |