Physics is powered by BepuPhysics 2.
Use the physics system when you need:
Use:
RigidbodyComponent with MotionType = StaticCollider-only entities are supported as true static collidables and triggers.
Use:
RigidbodyComponent with MotionType = DynamicThis is the normal setup for movable simulated props.
Use:
RigidbodyComponent with MotionType = KinematicUse this for scripted moving platforms or objects that should push dynamic bodies without being force-driven themselves.
Use:
RigidbodyComponent with MotionType = DynamicCapsuleColliderComponentCharacterControllerComponentAdd SimplePlayerInputComponent if you want the built-in input-driven movement path.
Important:
CapsuleColliderComponent must be the first enabled collider on the entityusing FrinkyEngine.Core.ECS;
public class PickupZone : Component
{
public override void OnTriggerEnter(Entity other)
{
FrinkyLog.Info($"{other.Name} entered the zone");
}
}
To make this work:
IsTrigger = true.| Motion Type | Use it for |
|---|---|
| Dynamic | fully simulated objects |
| Kinematic | scripted movers that still affect dynamic bodies |
| Static | immovable collision surfaces |
Scene gravity comes from Scene.PhysicsSettings.Gravity. Runtime gravity changes apply immediately, including changes made through the physics_gravity console CVar.
| Collider | Use it for |
|---|---|
BoxColliderComponent |
boxes, walls, rectangular triggers |
SphereColliderComponent |
radial triggers and simple round objects |
CapsuleColliderComponent |
characters and capsule-like actors |
MeshColliderComponent |
static or kinematic triangle-mesh collision |
All colliders support:
Center offset from the entity originIsTrigger for overlap-only behaviorMeshColliderComponent builds a triangle mesh from MeshPath or, if UseMeshRendererWhenEmpty is enabled, from the sibling MeshRendererComponent.
Use raycasts to check what is under a cursor, in front of an entity, or between two points.
using FrinkyEngine.Core.Physics;
if (Physics.Raycast(origin, direction, 100f, out var hit))
{
FrinkyLog.Info($"Hit {hit.Entity.Name} at {hit.Point}");
}
Use RaycastAll when you need every hit instead of the closest one.
The editor includes physics helpers:
F8 collider wireframe previewF9 collider edit mode for resizing and repositioning collider shapesMeshColliderComponent is best for static or kinematic collision.