Physics collision detection and new properties

Posted on

Physics collision demo

We now support collision detection using our physics engine (Kraft). You can be notified when a particular object collides, and you can check with what it collided.

Big thanks for implementing this feature go to Andrzej Kilijański!

Collisions can be checked in two ways:

  1. By getting a list of colliding TRigidBody objects from TRigidBody.GetCollidingTransforms. Works like get_colliding_bodies() in Godot.
  2. By using OnCollisionEnter and OnCollisionExit events on TRigidBody. This is similar to Unity.

Simple example to demonstrate it is in examples/physics/physics_2d_collisions directory of the engine.

We also have new properties on TRigidBody, and some internal things are now cleaner (again thanks to Andrzej Kilijański!). New properties:

Start the discussion at Castle Game Engine Forum