MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / processContactPointData

Method processContactPointData

examples/SharedMemory/PhysicsDirect.cpp:457–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457bool PhysicsDirect::processContactPointData(const struct SharedMemoryCommand& orgCommand)
458{
459 SharedMemoryCommand command = orgCommand;
460
461 const SharedMemoryStatus& serverCmd = m_data->m_serverStatus;
462
463 do
464 {
465 bool hasStatus = m_data->m_commandProcessor->processCommand(command, m_data->m_serverStatus, &m_data->m_bulletStreamDataServerToClient[0], SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE);
466
467 b3Clock clock;
468 double startTime = clock.getTimeInSeconds();
469 double timeOutInSeconds = m_data->m_timeOutInSeconds;
470
471 while ((!hasStatus) && (clock.getTimeInSeconds() - startTime < timeOutInSeconds))
472 {
473 const SharedMemoryStatus* stat = processServerStatus();
474 if (stat)
475 {
476 hasStatus = true;
477 }
478 }
479
480 m_data->m_hasStatus = hasStatus;
481 if (hasStatus)
482 {
483 if (m_data->m_verboseOutput)
484 {
485 b3Printf("Contact Point Information Request OK\n");
486 }
487 int startContactIndex = serverCmd.m_sendContactPointArgs.m_startingContactPointIndex;
488 int numContactsCopied = serverCmd.m_sendContactPointArgs.m_numContactPointsCopied;
489
490 m_data->m_cachedContactPoints.resize(startContactIndex + numContactsCopied);
491
492 b3ContactPointData* contactData = (b3ContactPointData*)&m_data->m_bulletStreamDataServerToClient[0];
493
494 for (int i = 0; i < numContactsCopied; i++)
495 {
496 m_data->m_cachedContactPoints[startContactIndex + i] = contactData[i];
497 }
498
499 if (serverCmd.m_sendContactPointArgs.m_numRemainingContactPoints > 0 && serverCmd.m_sendContactPointArgs.m_numContactPointsCopied)
500 {
501 m_data->m_hasStatus = false;
502
503 command.m_type = CMD_REQUEST_CONTACT_POINT_INFORMATION;
504 command.m_requestContactPointArguments.m_startingContactPointIndex = serverCmd.m_sendContactPointArgs.m_startingContactPointIndex + serverCmd.m_sendContactPointArgs.m_numContactPointsCopied;
505 command.m_requestContactPointArguments.m_objectAIndexFilter = -1;
506 command.m_requestContactPointArguments.m_objectBIndexFilter = -1;
507 }
508 }
509 } while (serverCmd.m_sendContactPointArgs.m_numRemainingContactPoints > 0 && serverCmd.m_sendContactPointArgs.m_numContactPointsCopied);
510
511 return m_data->m_hasStatus;
512}
513
514bool PhysicsDirect::processCamera(const struct SharedMemoryCommand& orgCommand)

Callers

nothing calls this directly

Calls 3

processCommandMethod · 0.45
getTimeInSecondsMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected