Separated Axis collision resolver
Controls
- ↑ and ↓ to control the speed
- ← and → to control the steering
Description
Control the tank and pick fuel. The collisions are managed using the Separated Axis Collision Theorem.
When a box of fuel is picking up, a script animation is executed before removing the box from available entities. The scipt is executed using Kotlin Coroutines.
To track the tank, the camera is simply attached to the tank. As it’s attached, moving the tank force the camera to move accordingly too, that’s create the tracking movement.
class TankSystem : System(EntityQuery(Tank::class)) {
private val satCollisionResolver = SATCollisionResolver()
private val energies by interested(EntityQuery(Energie::class))
override fun update(delta: Seconds, entity: Entity) {
energies.toMutableList().forEach { cube ->
if (satCollisionResolver.collide(entity, cube)) {
// collision !
}
}
}
}