EngineIntermediate
Physics, collisions, and triggers
Apply forces, receive collision callbacks, configure triggers, and query the world.
Rigid-body control
addForce(x, y, z)applies continuous force.addImpulse(x, y, z)applies an instantaneous impulse.addTorque(x, y, z)applies rotational force.
Collision callbacks
Call registerForCollisions() from init() before using collision or trigger callbacks.
function init()
gameObject.registerForCollisions()
end
function onCollisionEnter(other)
print("Hit " .. other.id)
print("Normal Y: " .. other.normal.y)
end
function onCollisionExit(other)
print("Left " .. other.id)
end
Callback data includes id, position, rotation, normal, and contactPoint. Treat it as callback-local data; copy plain numbers if you need them later.
Trigger volumes
Enable Trigger Volume on a cube, sphere, or capsule. Triggers do not block motion and invoke onTriggerEnter(other) and onTriggerExit(other). They are simulated as kinematic moving-layer sensors so they can detect static bodies and characters.
Spatial queries
raycast(direction, maxDistance)sphereQuery(radius)boxQuery(halfExtents)