Put simply, how can I check whether a collision has occurred between two vehicles? I have found this in the campaigns for chapter1 which would seem to do the trick (chapter1_walljump.lua): Code: local function onObjectCollision(objA, objB) -- log('A', logTag, 'onObjectCollision called objA : '..objA..', objB: '..objB) local wall = scenetree.findObject(wallInstance) if wall then local wallID = wall:getID() if wallID == objA or wallID == objB then playerHitTheWall = true end end end However, this never runs when adapted for my code (quick debug message to show current state): Code: local function onObjectCollision(objA, objB) helper.flashUiMessage('Triggering!', 1) end M.onObjectCollision = onObjectCollision return M Is there something I need to trigger it? Thanks for any help.
Yes. I am not sure why it doesn't work either; I feel like I have done something really stupid here but can't seem to find out what that something is...
Check "map.objects" it contains an "objectCollisions" attribute for each object. When a collision happens, you'll see it there.