I recently started using BUMP as my collision library after giving up on trying to make collisions myself. So far everything is smooth until I wanted to change the type of collision. I cannot understand how to change the collision of certain objects when it collides with other certain objects. EX: Player collides with wall, but passes coin. How can I do this? I know there's a way, and Vive tried it, its like a weird local function:
local playerFilter = function(item, other)
if other.isCoin then return 'cross'
elseif other.isWall then return 'slide'
elseif other.isExit then return 'touch'
elseif other.isSpring then return 'bounce'
end
-- else return nil
end
But I have not been able to use it on any of my code, it just wont work. I wrote some program that uses BUMP and IM trying to implement it. Any help would be greatly appreciated.
It's a function you pass to world:move, the function arguments are the 2 colliding entities. In the example filter you posted, you would move your player by calling
In the example filter function, argument 'other' would become what player collides with. Your tables for the objects would then need to be similar to the following: