getCollisionResultPosition collision with other moving nodes

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
KG
Posts: 35
Joined: Wed Jun 07, 2006 12:00 am

getCollisionResultPosition collision with other moving nodes

Post 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?
rimbou
Posts: 20
Joined: Fri Nov 24, 2006 12:09 pm

Post 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
Last edited by rimbou on Sat Feb 19, 2011 3:48 am, edited 1 time in total.
KG
Posts: 35
Joined: Wed Jun 07, 2006 12:00 am

Post 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.
Post Reply