- Notifications
You must be signed in to change notification settings - Fork22
Integrate Bullet Physics and V-HACD into jMonkeyEngine projects (code has New BSD license)
License
stephengold/Minie
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
TheMinie Project is about improving the integration ofBullet real-time physics simulationandKhaled Mamou's V-HACD Library intothe jMonkeyEngine (JME) game engine.
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
TheDacWizard
application, formerly a subproject,is nowa separate project at GitHub.
TheVhacdTuner
application, formerly a subproject,is nowa separate project at GitHub.
Complete source code (in Java) is provided undera 3-clause BSD license.
- 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
jMonkeyEngine comes withjme3-jbullet
,its own Bullet integration library.Why use Minie instead ofjme3-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 fixeswill 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 fieldsand less aliasing of small objects like vectors. This reduces the riskof accidentally corrupting its internal data structures.
- Minie validates method arguments. This helps detect usage errors thatcan 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
btSoftBody
andbtSoftRigidDynamicsWorld
,including anchors and soft-body joints - Multi-body simulation based on
btMultiBody
andbtMultiBodyDynamicsWorld
- Convex decomposition of meshes usingKhaled Mamou's V-HACD Library,including progress listeners
New6Dof
physics joints based onbtGeneric6DofSpring2Constraint
- Alternative contact-and-constraint solvers based on
btDantzigSolver
,btLemkeSolver
,btSolveProjectedGaussSeidel
, andbtNNCGConstraintSolver
- collision shapes:
MultiSphere
shapes based onbtMultiSphereShape
Box2dShape
shapes based onbtBox2dShape
Convex2dShape
shapes based onbtConvex2dShape
EmptyShape
shape 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 multibodiesimplement the
JmeCloneable
andComparable
interfaces - 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
:useDynamicAnimControl
insteadRagdollUtils
: not needed
Other important differences:
PhysicsSpace.addAll()
andPhysicsSpace.removeAll()
add/remove collisionobjects only; they do not add/remove joints.RagdollCollisionListener
interface changed and movedfrom thecom.jme3.bullet.collision
packageto thecom.jme3.bullet.animation
package.
Newer releases (since v0.5.0) can be downloaded fromGitHub.
Older releases (v0.1.1 through v0.4.5) can be downloaded fromthe Jme3-utilities Project.
Maven artifacts since v3.1.0 are available fromMavenCentral.
Package names begin withjme3utilities.
(if Stephen Gold holds the copyright) orcom.jme3.
/jme3test.
(if the jMonkeyEngine Project holds the copyright).
The source code and pre-built libraries are compatible with JDK 8.
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 zoneor 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 easilyimplemented from scratch.
Other games require physics simulation, either because detailed physics isintegral to gameplay (as in bowling or auto racing) or else to enhance theverisimilitude of effects such as collapsing buildings and/or people.For such games, a real-time physics library such as Minie should prove useful.
The computational cost of collision detection grows rapidly withthe 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 bymerging static bodies together andsimulating only the most relevant moving bodies.
- Minimize the number of nodes in each soft body.
For a physics simulation, it might seem natural to choose kilograms and metersas 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 havemasses 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 documentationrecommends against doing so.For some collision shapes, margin increases the effective size of the objectand distorts its effective shape.For this reason, it's undesirable to have a collision objectwith 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 areequivalent to world coordinates, these recommendations could impactmodel creation and scene-graph design.Physics units should therefore be chosen with care,preferably early in the development process.
How to build Minie from source
- 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
An overview of the demo applications
- the Minie Physics Library pageinthe JmonkeyEngine Library
- The Bullet Physics SDK Manual (2015)
- The physics section of the jMonkeyEngine Wiki (2020)
- Alan Chou's game-physics tutorial (2013)
- V-HACD v4 slideshow (2022)
YouTube videos about Minie:
- September 2022 teaser (splitting rigid bodies in real time)watch (0:53)source code
- August 2022 walkthru of the VhacdTuner applicationwatch (7:45)source code
- June 2019 teaser #2 (rubber duck)watch (0:16)source code
- June 2019 teaser #1 (jogger in skirt)watch (0:24)source code
- May 2019 teaser #3 (wind-blown flag)watch (0:06)source code
- May 2019 teaser #2 (squishy ball and tablecloth)watch (0:12)source code
- May 2019 teaser #1 (squishy ball)watch (0:13)source code
- April 2019 walkthru of the DacWizard applicationwatch (8:12)source code
- March 2019 short demo (IK for head/eye directions)watch (1:25)source code
- March 2019 teaser (buoyancy)watch (0:10)source code
- February 2019 demo (ropes)watch (4:47)source code
- December 2018 demo (inverse kinematics)watch (6:27)source code
- December 2018 teaser (inverse kinematics)watch (0:51)
- November 2018 demo (single-ended joints)watch (5:50)source code
- November 2018 demo (
MultiSphere
shape)watch (0:13)source code - October 2018 demo (
DynamicAnimControl
ragdolls)watch (2:49)source code
The evolution of this project is chronicled inits release log.
Most of Minie was originally forked fromjme3-bullet
,a library in thejMonkeyEngine Game Engine.
From January to November 2018, Minie was a subproject ofthe Jme3-utilities Project.
Since November 2018, Minie has been a separate project, hosted atGitHub.
Like most projects, the Minie Project builds on the work of many whohave gone before. I therefore acknowledge the followingartists and software developers:
- Normen Hansen (aka "normen") for creating most of the
jme3-bullet
library(on which Minie is based) and also for helpful insights - Rémy Bouquet (aka "nehon") for co-creating
KinematicRagdollControl
(on whichDynamicAnimControl
is based),for creating the Jaime model, and also for many helpful insights - Jules (aka "dokthar") for creatingthe soft-body fork of jMonkeyEnginefrom which Minie's soft-body support is derived
- Khaled Mamou for creating and licensing theV-HACD Libraryfor decomposing meshes into convex hulls
- Riccardo Balbo (aka "riccardo") for creating and licensingtheV-HACD Java Bindings Project
- "ndebruyn" for early testing of Minie on Android platforms
- Pavly Gerges (aka "Pavl_G") for testing Minie on Raspberry Pi
- Adam T. Ryder (aka "tryder") for creating and licensingthejME-TTF rendering system
- [Paul Speed (aka "pspeed42")][pspeed], for creating theSimMath library
- "oxplay2", for reporting a
PhysicsRigidBody
bug and helping me pin it down - "duncanj", for pull request #15
- "qwq", for suggesting changes to how rigid-body contacts are managedand for authoring the
ConveyorDemo
application - Nathan Vegdahl, for creating the Puppet model
- Tobias Jung, for distributingProFont
- plus the creators of (and contributors to) the following software:
- theAntora static website generator
- theBlender 3-D animation suite
- theBullet real-time physics library
- theCheckstyle tool
- theFindBugs source-code analyzer
- theFirefox andGoogle Chrome web browsers
- theGit revision-control system and GitK commit viewer
- theGitKraken client
- theGNU Project Debugger
- theGradle build tool
- theIntelliJ IDEA andNetBeans integrated development environments
- theJava compiler, standard doclet, and runtime environment
- jMonkeyEngine and the jME3 Software Development Kit
- theLinux Mint operating system
- LWJGL, the Lightweight Java Game Library
- theMakeHuman 3-D character creation tool
- theMarkdown document-conversion tool
- theMeld visual merge tool
- Microsoft Windows
- theNifty graphical user-interface library
- Open Broadcaster Software Studio
- the PMD source-code analyzer
- ProFont, the programmers' font
- theWinMerge differencing and merging tool
I am grateful toGitHub,Sonatype,JFrog,Travis,MacStadium,YouTube, andImgurfor providing free hosting for this projectand many other open-source projects.
I'm also grateful to my dear Holly, for keeping me sane.
If I've misattributed anything or left anyone out, please let me know, so I cancorrect the situation:sgold@sonic.net
About
Integrate Bullet Physics and V-HACD into jMonkeyEngine projects (code has New BSD license)