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

Method connect

examples/RobotSimulator/b3RobotSimulatorClientAPI.cpp:85–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85bool b3RobotSimulatorClientAPI::connect(int mode, const std::string& hostName, int portOrKey)
86{
87 if (m_data->m_physicsClientHandle)
88 {
89 b3Warning("Already connected, disconnect first.");
90 return false;
91 }
92 b3PhysicsClientHandle sm = 0;
93
94 int udpPort = 1234;
95 int tcpPort = 6667;
96 int key = SHARED_MEMORY_KEY;
97
98 switch (mode)
99 {
100 case eCONNECT_EXISTING_EXAMPLE_BROWSER:
101 {
102 sm = b3CreateInProcessPhysicsServerFromExistingExampleBrowserAndConnect(m_data->m_guiHelper);
103 break;
104 }
105
106 case eCONNECT_GUI:
107 {
108 int argc = 0;
109 char* argv[1] = {0};
110#ifdef __APPLE__
111 sm = b3CreateInProcessPhysicsServerAndConnectMainThread(argc, argv);
112#else
113 sm = b3CreateInProcessPhysicsServerAndConnect(argc, argv);
114#endif
115 break;
116 }
117 case eCONNECT_GUI_SERVER:
118 {
119 int argc = 0;
120 char* argv[1] = {0};
121#ifdef __APPLE__
122 sm = b3CreateInProcessPhysicsServerAndConnectMainThread(argc, argv);
123#else
124 sm = b3CreateInProcessPhysicsServerAndConnect(argc, argv);
125#endif
126 break;
127 }
128 case eCONNECT_DIRECT:
129 {
130 sm = b3ConnectPhysicsDirect();
131 break;
132 }
133 case eCONNECT_SHARED_MEMORY:
134 {
135 if (portOrKey >= 0)
136 {
137 key = portOrKey;
138 }
139 sm = b3ConnectSharedMemory(key);
140 break;
141 }
142 case eCONNECT_UDP:

Callers 7

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
initPhysicsMethod · 0.45
initPhysicsMethod · 0.45
initPhysicsMethod · 0.45
initPhysicsMethod · 0.45

Calls 2

b3CanSubmitCommandFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected