create premake/cmake file for Bullet/Extras/obj2sdf
add missing 1.sdf for Bullet/data/kitchens/1.sdf add support for getting keyboard events (pybullet.getKeyboardEvents and b3RobotSimulatorClientAPI::getKeyboardEvents)
This commit is contained in:
@@ -52,6 +52,8 @@ struct PhysicsDirectInternalData
|
||||
btAlignedObjectArray<b3VisualShapeData> m_cachedVisualShapes;
|
||||
btAlignedObjectArray<b3VRControllerEvent> m_cachedVREvents;
|
||||
|
||||
btAlignedObjectArray<b3KeyboardEvent> m_cachedKeyboardEvents;
|
||||
|
||||
btAlignedObjectArray<b3RayHitInfo> m_raycastHits;
|
||||
|
||||
PhysicsCommandProcessorInterface* m_commandProcessor;
|
||||
@@ -667,10 +669,23 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
|
||||
{
|
||||
b3Printf("Request VR Events completed");
|
||||
}
|
||||
m_data->m_cachedVREvents.clear();
|
||||
m_data->m_cachedVREvents.resize(serverCmd.m_sendVREvents.m_numVRControllerEvents);
|
||||
for (int i=0;i< serverCmd.m_sendVREvents.m_numVRControllerEvents;i++)
|
||||
{
|
||||
m_data->m_cachedVREvents.push_back(serverCmd.m_sendVREvents.m_controllerEvents[i]);
|
||||
m_data->m_cachedVREvents[i] = serverCmd.m_sendVREvents.m_controllerEvents[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CMD_REQUEST_KEYBOARD_EVENTS_DATA_COMPLETED:
|
||||
{
|
||||
if (m_data->m_verboseOutput)
|
||||
{
|
||||
b3Printf("Request keyboard events completed");
|
||||
}
|
||||
m_data->m_cachedKeyboardEvents.resize(serverCmd.m_sendKeyboardEvents.m_numKeyboardEvents);
|
||||
for (int i=0;i<serverCmd.m_sendKeyboardEvents.m_numKeyboardEvents;i++)
|
||||
{
|
||||
m_data->m_cachedKeyboardEvents[i] = serverCmd.m_sendKeyboardEvents.m_keyboardEvents[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1031,6 +1046,13 @@ void PhysicsDirect::getCachedVREvents(struct b3VREventsData* vrEventsData)
|
||||
&m_data->m_cachedVREvents[0] : 0;
|
||||
}
|
||||
|
||||
void PhysicsDirect::getCachedKeyboardEvents(struct b3KeyboardEventsData* keyboardEventsData)
|
||||
{
|
||||
keyboardEventsData->m_numKeyboardEvents = m_data->m_cachedKeyboardEvents.size();
|
||||
keyboardEventsData->m_keyboardEvents = keyboardEventsData->m_numKeyboardEvents?
|
||||
&m_data->m_cachedKeyboardEvents[0] : 0;
|
||||
}
|
||||
|
||||
void PhysicsDirect::getCachedRaycastHits(struct b3RaycastInformation* raycastHits)
|
||||
{
|
||||
raycastHits->m_numRayHits = m_data->m_raycastHits.size();
|
||||
|
||||
Reference in New Issue
Block a user