Hi there
I have 2 physic oblects... lets say 2 rectangles...in one state thery should be solid... in another state they should be able to pass each other...
1st state: [1] -> <- [2] = [1][1]
2nd state: [1] -> <- [2] = <- [2][1] ->
Any idea who to make this?
you should use collision filters
Have a look at this thread. It's deals with letting objects pass through each other.
https://developer.anscamobile.com/forum/2011/11/02/collision-detection-not-very-good
I guess you could have a function that says:
1
2
3
4
5
6
7
8
| if "rectangle1" collides with "rectangle2" then
if collision.phase == "began" then
rectangle1:removePhysicsBody()
elseif collision.phase == "ended" then
rectangle2:addPhysicsBody()
end
end
|