Bug fix. Only return friction coefficient when there is a valid link collider.

This commit is contained in:
yunfeibai
2017-06-08 18:59:11 -07:00
parent e5ce067cb9
commit 037043467a

View File

@@ -4528,7 +4528,15 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
else
{
serverCmd.m_dynamicsInfo.m_mass = mb->getLinkMass(linkIndex);
serverCmd.m_dynamicsInfo.m_lateralFrictionCoeff = mb->getLinkCollider(linkIndex)->getFriction();
if (mb->getLinkCollider(linkIndex))
{
serverCmd.m_dynamicsInfo.m_lateralFrictionCoeff = mb->getLinkCollider(linkIndex)->getFriction();
}
else
{
b3Warning("The dynamic info requested is not available");
serverCmd.m_type = CMD_GET_DYNAMICS_INFO_FAILED;
}
}
hasStatus = true;
}