lua.box3d.world.prepare_events
events = world:prepare_events()
events = world:prepare_events(events)
Prepare a table to be filled with all events.
events.uids
Lookup table by uid of events by body.uid or shape.uid A single event may appear multiple times but it will be the same table.
events.all
A list of all events regardless of a uid being set.
events:insert(event,ita,itb)
Helper function to place an event in uids and all. ita and itb may be nil or a shape or a body. We look for ita.uid and itb.uid to fill the uids map.
events.contact_cache
cache of contacts for multiple calls to events.contact to reuse
events:contact(id)
Get contact information from a contact id, we cache results in events.contact_cache so multiple calls will return the same table so is safe to call multiple times with the same id.
A contact is a large chunk of possibly unwanted data so has to be explicitly requested later using the contactId provided by contact events.
May possibly be nil if an invalid contact ID, eg this is old data and you called world:step again and created new contacts.
for event in events:iterate(uid) do ... end
A simple iterator function for the events associated with the given uid, or all events if uid is nil.