Physics#

Back To Features

GameKit integrates the dyn4j physics engine to handle collision detection and resolution between entities with the RigidBody component.

The physics engine is not something you would have to interact with directly. Entities with the RigidBody are automatically added to the physics world and updated accordingly. The physics engine also notifies collision listeners on collider components when they are involved in collisions.

Static Methods#

Method Description
addBody Adds a RigidBody to the physics world for simulation
Automatically called by RigidBody components
removeBody Removes a RigidBody from the physics world
Automatically called by RigidBody components
addCollisionListener Registers a collision listener with the specified id
Automatically called by Collider components
removeCollisionListener Removes a collision listener
Automatically called by Collider components
raycast +1 Projects a ray from one point to another point and returns a list of hit results which contain information on the hit point, hit normal and the Collider components that were hit

+2 Projects a fixed-length ray from starting position with the specified angle (in radian) and returns a list of hit results which contain information on the hit point, hit normal and the Collider components that were hit