🧱 Collision, Trigger and Slope System
The GameCrom engine uses a highly optimized hybrid collision detection system,
based on axis-aligned rectangles (AABB) and circles.
⚙️ General Concepts
- Collisions are calculated automatically every frame.
- Supports three modes: Rectangular (AABB) and Circular.
- No physical rotation is supported: all rectangles remain axis-aligned.
- Compatible with triggers, basic physics, gravity and parent–child hierarchies.
- The engine separates objects upon contact to avoid visible overlaps.
💠 Collision Types
1️⃣ Rectangular (AABB)
This is the main collision system.
Each object uses an axis-aligned rectangle to detect contact with others.
It is fast, stable and ideal for platforms, walls and floors.
2️⃣ Circular
Used for rounded objects such as projectiles, coins, spherical enemies or particles.
Collisions are detected using radius distance checks, ensuring smooth and natural response.
- Detects intermediate impacts between frames.
- Can be enabled in the editor to automatically increase collision precision.
- Ideal for bullets, fast enemies or moving platforms.
🪜 Slope System (Player Platform)
The engine does not handle real physical ramp collisions,
but the Player Platform behaviour includes visual slope detection.
This allows the player to climb over small height differences or hand-drawn ramp-like surfaces made using stepped tiles.
- The system calculates the height of the surface underneath the player.
- If the next stepped surface has a height difference less than or equal to the Player Platform’s Slope value, the player is lifted automatically.
- No angular physical collision: it’s purely a visual movement adaptation.
- Compatible with moving and static platforms.
🔸 Slope only affects player movement, not the global collision system.
🔸 Ramps do not affect the physics of other world objects.
🧩 Triggers (Detection Zones)
Triggers are special areas that detect the entry or exit of objects without applying any physical force.
They allow the creation of interactive zones you can walk through: damage areas, pickups, switches, checkpoints, etc.
- Use the events OnTriggerEnter, OnTriggerStay and OnTriggerExit.
- Work with both rectangular and circular collision shapes.
- Can coexist with physical objects without interfering.
🎮 Physical Behaviour
- Physical objects apply gravity and correct their position upon collision.
- Gravity only applies if the object is not marked Static.
- Static objects act as solid, immovable surfaces.
- The engine applies a minimal separation between objects upon contact.
- No physical bounce or friction is calculated (can be simulated via script).
⚡ Available Events
- OnCollisionEnter – When two objects start touching.
- OnCollisionStay – While they remain in contact.
- OnCollisionExit – When contact ends.
- OnTriggerEnter / Stay / Exit – Non-physical detection events.
📌 Summary
– Hybrid AABB + Circle system with automatic detection.
– Compatible with basic physics, gravity, triggers and hierarchies.
– Visual Slope support for Player Platform movement.
– No physical rotation support for Square-type collisions or real ramps.
⚠️ Current Limitations
- No support for rotated rectangle collisions.
- Slope only affects the player, not other objects.
- No friction or physical bounce (can be scripted).
- Extremely fast collisions may require timestep or deltaTime tuning.
🧩 Upcoming improvements:
- Configurable friction and bounce coefficients.
- Real slope physics for future engine versions.