forked from bulletphysics/bullet3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve premake4 build in case X11 headers are missing
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); }
- Loading branch information
1 parent
1de2269
commit 1e8f39b
Showing
4 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters