Minie
Integrate Bullet Physics and V-HACD into jMonkeyEngine projects (code has New BSD license)
Install / Use
/learn @stephengold/MinieREADME
The [Minie Project][project] is about improving the integration of [Bullet real-time physics simulation][bullet] and [Khaled Mamou's V-HACD Library][vhacd] into [the jMonkeyEngine (JME) game engine][jme].
It contains 6 subprojects:
- MinieLibrary: the Minie runtime library and its automated tests
- TutorialApps: tutorial apps
- MinieExamples: demos, examples, and non-automated test software
- MinieAssets: generate assets used in MinieExamples
- MinieDump: a command-line utility to dump J3O assets
- Jme3Examples: physics examples from jme3-examples
The DacWizard application, formerly a subproject,
is now [a separate project at GitHub][dacwizard].
The VhacdTuner application, formerly a subproject,
is now [a separate project at GitHub][vhacdTuner].
Complete source code (in Java) is provided under [a 3-clause BSD license][license].
<a name="toc"></a>
Contents of this document
- Why use Minie?
- Downloads
- Conventions
- Overview and design considerations
- How to build Minie from source
- Tutorials
- An overview of the demo applications
- External links
- History
- Acknowledgments
<a name="why"></a>
Why use Minie?
[jMonkeyEngine][jme] comes with jme3-jbullet,
its own Bullet integration library.
Why use Minie instead of jme3-jbullet?
- Minie has many more features. (See the feature list below.)
- Minie fixes many bugs found in
jme3-jbullet. - Due to its shorter release cycle, future features and bug fixes will probably appear first in Minie.
- Minie uses automated testing to reduce the risk of regressions and new bugs.
- Minie's classes are better encapsulated, with fewer public/protected fields and less aliasing of small objects like vectors. This reduces the risk of accidentally corrupting its internal data structures.
- Minie validates method arguments. This helps detect usage errors that can lead to subtle bugs.
- Minie's source code is more readable and better documented.
Summary of added features:
- Extensions to
DynamicAnimControl - Soft-body simulation based on
btSoftBodyandbtSoftRigidDynamicsWorld, including anchors and soft-body joints - Multi-body simulation based on
btMultiBodyandbtMultiBodyDynamicsWorld - Convex decomposition of meshes using [Khaled Mamou's V-HACD Library][vhacd], including progress listeners
New6Dofphysics joints based onbtGeneric6DofSpring2Constraint- Alternative contact-and-constraint solvers based on
btDantzigSolver,btLemkeSolver,btSolveProjectedGaussSeidel, andbtNNCGConstraintSolver - collision shapes:
MultiSphereshapes based onbtMultiSphereShapeBox2dShapeshapes based onbtBox2dShapeConvex2dShapeshapes based onbtConvex2dShapeEmptyShapeshape based onbtEmptyShape
- debugging aids:
- dump the contents of a
BulletAppState,PhysicsSpace,CollisionShape, orMultiBody - visualize physics objects in multiple viewports
- customize debug material per collision object
- visualize the local axes, velocities, bounding boxes, CCD swept spheres, and gravity vectors of collision objects
- visualize the children of compound collision shapes
- optional high-resolution debug meshes for convex shapes
- options to generate debug meshes that include indices, normals (for shading), and/or texture coordinates (for texturing)
- dump the contents of a
- all joints, shapes, collision objects, and multibodies
implement the
JmeCloneableandComparableinterfaces - enable/disable a
PhysicsJoint - single-ended physics joints
- ignore lists for collision objects
- application-specific data for collision objects
- access more parameters of rigid bodies, vehicles, characters, joints, collision shapes, contact/constraint solvers, etcetera
- option to apply scaling with a
RigidBodyControl
Some jme3-jbullet classes that Minie omits:
KinematicRagdollControl,HumanoidRagdollPreset, andRagdollPreset: useDynamicAnimControlinsteadRagdollUtils: not needed
Other important differences:
PhysicsSpace.addAll()andPhysicsSpace.removeAll()add/remove collision objects only; they do not add/remove joints.RagdollCollisionListenerinterface changed and moved from thecom.jme3.bullet.collisionpackage to thecom.jme3.bullet.animationpackage.
<a name="downloads"></a>
Downloads
Newer releases (since v0.5.0) can be downloaded from GitHub.
Older releases (v0.1.1 through v0.4.5) can be downloaded from the Jme3-utilities Project.
Maven artifacts since v3.1.0 are available from MavenCentral.
<a name="conventions"></a>
Conventions
Package names begin with jme3utilities.
(if Stephen Gold holds the copyright) or
com.jme3./jme3test. (if the jMonkeyEngine Project holds the copyright).
The source code and pre-built libraries are compatible with JDK 8.
<a name="overview"></a>
Overview and design considerations
The role of physics simulation in games
Most computer games don't require detailed physics simulation.
- Canned animations usually suffice to illustrate characters walking, jumping, and fighting.
- Detecting when a character enters a fixed zone or comes into range of another character is a simple geometric calculation, provided the zone or range has a box or sphere shape.
- For outer-space games, the equations of motion (Newton's 3rd Law) are easily implemented from scratch.
Other games require physics simulation, either because detailed physics is integral to gameplay (as in bowling or auto racing) or else to enhance the verisimilitude of effects such as collapsing buildings and/or people. For such games, a real-time physics library such as Minie should prove useful.
How Minie works
Computational efficiency
The computational cost of collision detection grows rapidly with the number of collision objects and the complexity of their shapes. To simulate physics in real time, with modest CPUs, it's vital to keep the physics simple:
- Use very simple collision shapes (such as boxes, capsules, and spheres) wherever possible.
- Minimize the number of collision objects by merging static bodies together and simulating only the most relevant moving bodies.
- Minimize the number of nodes in each soft body.
Scaling the world
For a physics simulation, it might seem natural to choose kilograms and meters as the units of mass and distance, respectively. However, this is not a requirement, and for many games, MKS units are not the best choice.
Bullet documentation recommends that dynamic bodies have masses as close as possible to 1.
Also, to improve the performance and reliability of collision detection, Bullet applies a margin to most collision objects. By default, this margin is 0.04 physics-space units (psu). While the margin is configurable, Bullet documentation recommends against doing so. For some collision shapes, margin increases the effective size of the object and distorts its effective shape. For this reason, it's undesirable to have a collision object with any radius smaller than about 0.2 psu.
Dynamic bodies in forced contact tend to jiggle. Jiggling is mostly noticeable for sharp-edged bodies (such as boxes) resting on uneven surfaces, under high gravity. The higher the gravity (in psu per second squared), the shorter the time step (in seconds) needs to be. For efficient and realistic simulation of Earth-like gravity (9.8 m/s^2) with the default margin (0.04 psu) and time step (0.0167 seconds), the psu should be 0.3 meters or larger. This puts a soft lower limit on the dimensions (in psu) of dynamic bodies.
Since Minie's debug visualization assumes that physics coordinates are equivalent to world coordinates, these recommendations could impact model creation and scene-graph design. Physics units should therefore be chosen with care, preferably early in the development process.
<a name="build"></a>
How to build Minie from source
How to build Minie from source
<a name="tutorials"></a> <a name="add"></a> <a name="rigidbody"></a> <a name="shape"></a> <a name="debugging"></a> <a name="new6dof"></a> <a name="dac"></a> <a name="detect"></a> <a name="softbody"></a>
Tutorials
- How to add Minie to an existing project
- An introduction to rigid-body physics
- Choosing collision shapes
- Debugging physics issues
- An introduction to New6Dof
- An introduction to DynamicAnimControl
- Collision detection
- An introduction to soft-body physics
<a name="demos"></a>
An overview of the demo applications
[A
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
