getCollisionResultPosition collision with other moving nodes
Posted: Sat Dec 16, 2006 10:19 pm
I am using getCollisionResultPosition for movement for a top-down hack and slash game, and it works perfectly for moving through the world. When the world is loaded, I create a MetaTriangleSelector, and then add the selectors of every static solid object to it as they're created.
Both the player and the enemies use a movement system that includes getCollisionResultPosition with the world's triangle selector, and they can walk through the world just fine. But, they'll just walk right through each other because it doesn't take other nodes into account.
I have made two attempts at collision with mobile nodes so far. The first was to move the character as usual, and then check to see if the new position causes a bounding box overlap with any other characters, and if so to move the character back to its old position. I thought this should have worked, but for some reason intersectsWithBox was returning true no matter where the other characters were, and was stopping movement completely.
The second attempt was to make a second "dynamic" MetaTriangleSelector. Every frame, I'd delete the dynamic selector, then recreate it, add the "static" selector to it, then get a selector from each character's node and adding it. I probably should have seen this before even trying it, but all it did was cause everything to collide with themselves.
Is there anything else I could try?
Both the player and the enemies use a movement system that includes getCollisionResultPosition with the world's triangle selector, and they can walk through the world just fine. But, they'll just walk right through each other because it doesn't take other nodes into account.
I have made two attempts at collision with mobile nodes so far. The first was to move the character as usual, and then check to see if the new position causes a bounding box overlap with any other characters, and if so to move the character back to its old position. I thought this should have worked, but for some reason intersectsWithBox was returning true no matter where the other characters were, and was stopping movement completely.
The second attempt was to make a second "dynamic" MetaTriangleSelector. Every frame, I'd delete the dynamic selector, then recreate it, add the "static" selector to it, then get a selector from each character's node and adding it. I probably should have seen this before even trying it, but all it did was cause everything to collide with themselves.
Is there anything else I could try?