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

Method initPhysics

examples/BulletRobotics/BoxStack.cpp:42–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 m_robotSim.debugDraw(debugDrawMode);
41 }
42 virtual void initPhysics()
43 {
44 int mode = eCONNECT_EXISTING_EXAMPLE_BROWSER;
45 m_robotSim.setGuiHelper(m_guiHelper);
46 bool connected = m_robotSim.connect(mode);
47
48 b3Printf("robotSim connected = %d", connected);
49
50 m_robotSim.configureDebugVisualizer(COV_ENABLE_RGB_BUFFER_PREVIEW, 0);
51 m_robotSim.configureDebugVisualizer(COV_ENABLE_DEPTH_BUFFER_PREVIEW, 0);
52 m_robotSim.configureDebugVisualizer(COV_ENABLE_SEGMENTATION_MARK_PREVIEW, 0);
53
54 b3RobotSimulatorLoadUrdfFileArgs args;
55 b3RobotSimulatorChangeDynamicsArgs dynamicsArgs;
56 int massRatio = 4;
57 int mass = 1;
58 for (int i = 0; i < 8; i++)
59 {
60 args.m_startPosition.setValue(0, 0, i * .06);
61 int boxIdx = m_robotSim.loadURDF("cube_small.urdf", args);
62 dynamicsArgs.m_mass = mass;
63 m_robotSim.changeDynamics(boxIdx, -1, dynamicsArgs);
64 mass *= massRatio;
65 }
66
67 m_robotSim.loadURDF("plane.urdf");
68 m_robotSim.setGravity(btVector3(0, 0, -10));
69 }
70
71 virtual void exitPhysics()
72 {

Callers

nothing calls this directly

Calls 8

changeDynamicsMethod · 0.80
btVector3Class · 0.50
setGuiHelperMethod · 0.45
connectMethod · 0.45
setValueMethod · 0.45
loadURDFMethod · 0.45
setGravityMethod · 0.45

Tested by

no test coverage detected