diff --git a/newton-4.00/applications/ndSandbox/demos/ndAdvancedIndustrialRobot.cpp b/newton-4.00/applications/ndSandbox/demos/ndAdvancedIndustrialRobot.cpp index 003b8d800..d8735130d 100644 --- a/newton-4.00/applications/ndSandbox/demos/ndAdvancedIndustrialRobot.cpp +++ b/newton-4.00/applications/ndSandbox/demos/ndAdvancedIndustrialRobot.cpp @@ -463,11 +463,6 @@ namespace ndAdvancedRobot } } - if (ModelCollided()) - { - return true; - } - return false; } @@ -518,6 +513,11 @@ namespace ndAdvancedRobot return ND_DEAD_PENALTY; } + if (ModelCollided()) + { + return ND_DEAD_PENALTY; + } + const ndMatrix effectorMatrix(m_effectorLocalTarget * m_arm_4->GetBody0()->GetMatrix()); const ndMatrix baseMatrix(m_effectorLocalBase * m_base_rotator->GetBody1()->GetMatrix()); const ndMatrix currentEffectorMatrix(effectorMatrix * baseMatrix.OrthoInverse()); @@ -574,7 +574,7 @@ namespace ndAdvancedRobot bool hitaLimit = m_arm_0->GetJointHitLimits() || m_arm_1->GetJointHitLimits(); - observation->m_hitLimit = ndBrainFloat (hitaLimit ? 1.0 : 0.0f); + observation->m_hitLimit = ndBrainFloat (hitaLimit ? 1.0f : 0.0f); observation->m_collided = ndBrainFloat(ModelCollided() ? 1.0f : 0.0f); const ndMatrix effectorMatrix(m_effectorLocalTarget * m_arm_4->GetBody0()->GetMatrix());