mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 05:40:05 +00:00
1e8f39b492
improve video_sync_mp4.py example allow to create a heightfield from file or programmatically in C++ robotics api. Example: { b3RobotSimulatorCreateCollisionShapeArgs shapeArgs; shapeArgs.m_shapeType = GEOM_HEIGHTFIELD; bool useFile = true; if (useFile) { shapeArgs.m_fileName = "D:/dev/bullet3/data/heightmaps/gimp_overlay_out.png"; shapeArgs.m_meshScale.setValue(.05, .05, 1); } else { shapeArgs.m_numHeightfieldColumns = 256; shapeArgs.m_numHeightfieldRows = 256; shapeArgs.m_meshScale.setValue(.05, .05, 1); shapeArgs.m_heightfieldData.resize(shapeArgs.m_numHeightfieldRows * shapeArgs.m_numHeightfieldColumns); double heightPerturbationRange = 0.05; for (int j = 0; j<int(shapeArgs.m_numHeightfieldColumns / 2); j++) { for (int i = 0; i < (int(shapeArgs.m_numHeightfieldRows / 2)); i++) { double height = ((double)rand() / (RAND_MAX)) * heightPerturbationRange; shapeArgs.m_heightfieldData[2 * i + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; } } } int shape = sim->createCollisionShape(shapeArgs.m_shapeType, shapeArgs); b3RobotSimulatorCreateMultiBodyArgs bodyArgs; bodyArgs.m_baseCollisionShapeIndex = shape; int groundId = sim->createMultiBody(bodyArgs); int texId = sim->loadTexture(shapeArgs.m_fileName); b3RobotSimulatorChangeVisualShapeArgs args; args.m_objectUniqueId = groundId; args.m_linkIndex = -1; args.m_textureUniqueId = texId; sim->changeVisualShape(args); } |
||
---|---|---|
.. | ||
Android/jni | ||
cmake | ||
bin2cpp.bat | ||
bin2cpp.lua | ||
bullet_ico.ico | ||
bullet.rc | ||
findDirectX11.lua | ||
findOpenCL.lua | ||
findOpenGLGlewGlut.lua | ||
lcpp.lua | ||
premake4_arm64 | ||
premake4_linux | ||
premake4_linux64 | ||
premake4_osx | ||
premake4_osx32 | ||
premake4.exe | ||
premake4.lua | ||
premake5.exe | ||
stringify.bat | ||
stringify.sh | ||
stringifyKernel.lua | ||
stringifyShaders.bat |