commonMain.de.fabmax.kool.physics.articulations.Articulation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kool-physics Show documentation
Show all versions of kool-physics Show documentation
A multiplatform OpenGL / Vulkan graphics engine written in kotlin
package de.fabmax.kool.physics.articulations
import de.fabmax.kool.math.Mat4f
import de.fabmax.kool.util.BaseReleasable
expect fun Articulation(isFixedBase: Boolean): Articulation
abstract class Articulation : BaseReleasable() {
protected val _links = mutableListOf()
val links: List get() = _links
val onFixedUpdate = mutableListOf<(Float) -> Unit>()
abstract var minPositionIterations: Int
abstract var minVelocityIterations: Int
abstract fun createLink(parent: ArticulationLink?, pose: Mat4f): ArticulationLink
abstract fun wakeUp()
abstract fun putToSleep()
fun onPhysicsUpdate(timeStep: Float) {
for (i in links.indices) {
links[i].onPhysicsUpdate(timeStep)
}
for (i in onFixedUpdate.indices) {
onFixedUpdate[i](timeStep)
}
}
}