Game Development Reference
In-Depth Information
The collision impact callback
Acting on collisions within the sandbox happens through the use of callbacks. To register
for a collision callback, you pass in the Lua function you want to be called whenever the
SandboxObject instance you're interested in collides with something. Callbacks happen
on a per-frame basis and only one invocation of a callback occurs even if there are multiple
collision points between two objects. For example, if ObjectA and ObjectB are collid-
ing at three different points, the callback function will be invoked once per sandbox update.
Note
Removing sandbox objects during a collision callback will disable any additional callback
functions that the sandbox might invoke within the sandbox's current update loop.
Assigning a collision callback function to a sandbox object is done through the AddCol-
lisionCallback function.
Sandbox.AddCollisionCallback(sandbox, sandboxObject,
function);
Search WWH ::




Custom Search