Skip to content

Physics

zeganstyl edited this page Sep 18, 2020 · 1 revision

Thelema have interfaces for rigid physics objects.

Physics package have PHYS singleton, that can create physics world.

Each world can create physical objects, that will be simulated/collided in that world.

Thelema primarily uses ODE as its default engine, and the interfaces have been tweaked primarily to work with this engine. It is assumed that interfaces for other physics engines could also be implemented, but this is not planned yet.

val world = PHYS.world()

val groundShape = world.boxShape(100f, 1f, 100f)
val groundBody = world.rigidBody(shape = boxShape, mass = 1f)
groundBody.isStatic = true
groundBody.isGravityEnabled = false

val boxShape = world.boxShape(1f, 1f, 1f)
val boxBody = world.rigidBody(shape = boxShape, mass = 1f)
boxBody.setPosition(0f, 5f, 0f)

Box shape test

Clone this wiki locally