lua.wetgenes.bullet.world.contacts
local contacts,csiz=world:contacts()
local contacts,csiz=world:contacts(min_dist)
local contacts,csiz=world:contacts(min_dist,min_impulse)
Fetch all contacts in the world that are the same or closer than min_dist which defaults to 0 and hit the same or harder than min_impulse which also defaults to 0. This helps filter out uninteresting collisions before we process them.
csiz, the second return allows us to put more info into each chunk in the future, it will probably be 10 but may grow if it turns out that more contact info for each point would help.
This returns a list of contacts. Each contact is an array that consists of.
a_body,
b_body,
and then 1 or more chunks of csiz (which is currently 10) numbers representing
ax,ay,az, -- world position on a_body
bx,by,bz, -- world position on b_body
nx,ny,nz, -- world normal on b_body
impulse, -- impulse applied by collision
So you can find the two bodys in contact[1] and contact[2] but are then expected to loop over the rest of the array as chunks of csiz like so.
for idx=3,#contact,csiz do
local pos_a={ contact[idx+0] , contact[idx+1] , contact[idx+2] }
local pos_b={ contact[idx+3] , contact[idx+4] , contact[idx+5] }
local nrm_b={ contact[idx+6] , contact[idx+7] , contact[idx+8] }
local impulse=contact[idx+9]
...
end
This is intended to be processed and interesting collisions handled or saved for later.