61315 / filament-physics

Physics simulation demo using Filament rendering engine and Bullet Physics SDK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filament-physics

Physics simulation demo using Filament rendering engine and Bullet Physics SDK.

filament-physics-cover

Preview

Cube Instancing Constraints
preview
CubeInstancingActivity.kt ConstraintsActivity.kt

What is Filament?

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.

What is Bullet?

Bullet is a physics SDK for real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Demo

Cube Istancing

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

References

Most of the reasoning was from the links below. One may find them useful.

License

filament-physics is available under the MIT license. See the LICENSE file for more info.

About

Physics simulation demo using Filament rendering engine and Bullet Physics SDK.

License:MIT License


Languages

Language:Kotlin 64.8%Language:Java 35.2%