Skip to content

Physics

class Physics(
internal var velocityX: Int = 0,
internal var velocityZ: Int = 0,
var thrust: Int = 0,
internal var forceX: Int = 0,
internal var forceZ: Int = 0,
internal var drag: Int = 0,
internal var lateralDrag: Int = 0,
internal var maxSpeed: Int = Int.MAX_VALUE
) : Component()
Example
fun fullSail(boat: WorldProjection) {
val physics = boat.findComponent<Physics>() ?: Physics().also { boat.addComponent(it) }
physics.thrust = 40
}
var thrust: Int