Physics simulation demo using Filament rendering engine and Bullet Physics SDK.
Cube Instancing | Constraints |
---|---|
![]() |
|
CubeInstancingActivity.kt |
ConstraintsActivity.kt |
Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small as possible and as efficient as possible on Android.
Bullet is a physics SDK for real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
This demo implements rudimentary instancing and rigid body simulations. Simply put😇, this demo loads a single glTF asset and creates copies of it, each attached with a rigid body from the physics engine that shares the transformation data of the rendering engine. The CubeInstancingActivity
creates a SurfaceView
and prepairs the rendering engine. The activity harnesses the ModelViewer
class to pipe down the boilerplating.
The CubeInstancingDemo
class initializes the physics world and performs the simulation. You can consult the manual for the details of the initialization phase. I have tried to keep it unopinionated as possible, it includes neither classes for node management nor interfaces that communicate with the physics engine, just so I have kept it simple.
You can tinker with the following constants in the CubeInstanceActivity.kt
:
// The number of concurrent rigid bodies
private const val INSTANCE_POOL_CAPACITY: Int = 100
// Feed rate
private const val CUBE_PER_SECOND: Int = 10
- How to render a renderable in different positions of one scene at a time #1513
- gltfio: Add support for "software instancing". #2607
- JBullet HelloWorld
- glTF-Sample-Models/2.0/Box
- Bullet
- JBullet
- Java port of Bullet Physics
- jbullet-jme
- jMonkeyEngine integration of JBullet
- affogato/JBullet-QIntBio-Fork
- A fork of JBullet
- davidB/jmbullet
- A fork of JBullet
- bubblecloud/jbullet ★
- A fork of JBullet, used in this project
- kotlin-graphics/bullet
- Kotlin port of Bullet Physics
- stephengold/Libbulletjme
- JNI implementation of Bullet Physics
- Many more...
Most of the reasoning was from the links below. One may find them useful.
- JStack or not JStack
- The versions of the JBullet
- Sceneform AR physics experiment
- ARCore integration
- Google codelabs demo
- CsabaConsulting/ARPhysics
- Sceneform integration
- mahmoudgalal/SceneForm-Bullet
- Introductory JNI wrapper for Bullet Physics and Sceneform integration
filament-physics is available under the MIT license. See the LICENSE file for more info.