Page 1 of 1

getCollisionResultPosition collision with other moving nodes

Posted: Sat Dec 16, 2006 10:19 pm
by KG
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?

Posted: Sat Dec 16, 2006 10:37 pm
by rimbou
You could check the distance between the dynamic nodes, but maybe it's not precise enough for your game. And checking the bounding boxes should work, maybe you did something wrong in your code?
________
Xanax Rehab Advice

Posted: Sat Dec 16, 2006 10:45 pm
by KG
I'll give checking bounding boxes another shot, it's probably the best way to go if I can get it to work. I never thought of checking distances, so I'll give that a try, as well. Thanks!

Do bounding boxes resize themselves as the node plays animations, or are they a fixed size when the node is created? If they're not fixed, is there a way to make them fixed? I don't want characters to get stuck on each other as they animate. I'm using .MS3D models with skeletal animations, if that makes a difference.

Edit: I have got the bounding box method working, but it seems that bounding boxes do change size as the model plays animations. It is causing things to get stuck on eachother as they animate.