Add the API to get the body name and pybullet example call.

This commit is contained in:
yunfeibai
2017-03-23 13:54:44 -07:00
parent 50f0cfca9e
commit d717b1db84
10 changed files with 146 additions and 7 deletions

View File

@@ -4906,8 +4906,26 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
break;
}
case CMD_REQUEST_BODY_NAME:
{
int bodyUniqueId = clientCmd.m_requestBodyNameArguments.m_bodyUniqueId;
InteralBodyData* body = m_data->getHandle(bodyUniqueId);
if (body)
{
SharedMemoryStatus& serverCmd = serverStatusOut;
serverCmd.m_type = CMD_REQUEST_BODY_NAME_COMPLETED;
strcpy(serverCmd.m_sendBodyNameArgs.m_bodyName, body->m_bodyName.c_str());
hasStatus = true;
}
else
{
b3Warning("The body name requested is not available");
SharedMemoryStatus& serverCmd = serverStatusOut;
serverCmd.m_type = CMD_REQUEST_BODY_NAME_FAILED;
hasStatus = true;
}
break;
}
default:
{
b3Error("Unknown command encountered");