Fixes for character collisions with other characters?
by Cinder Games · in Torque Game Engine · 10/22/2005 (4:33 am) · 7 replies
I know there's been an issue with characters passing thru eachother given the "right circumstances" for some time, as i've read about them on the board for awhile..... Has anyone found a better method/routine for the collision detection to prevent this from happening? Do hitboxes help by adding more convexs boxes to check against before saying it's clear to move?


I mean, it doesn't happen all the time... and i have to try to do it.. move around int circles around the other character then like magic i'm inside the other player. I know others have had this issue, just looking for perhaps some addition checks to prevent this from ever happening. The engine is designed for networking and does "prediction" which was clearly off in this example. IS there a way to increase it's prediction accuracy?


I mean, it doesn't happen all the time... and i have to try to do it.. move around int circles around the other character then like magic i'm inside the other player. I know others have had this issue, just looking for perhaps some addition checks to prevent this from ever happening. The engine is designed for networking and does "prediction" which was clearly off in this example. IS there a way to increase it's prediction accuracy?
#2
I would first install one of them, getting your chars to the point where they now have additional possible collision boxes. In a few of the raycast functions, you can make a conditional check for when you _might_ want to use these other boxes, should the main stock collision box (mObjBox) signal a collision. Just make sure any initial check you make is extremely efficient, with plenty of chances to 'early out'. If all your conditions exist, you can then check based on the new boxes, which of course fit your char much tighter.
I would not use this for movement itself, thats simply called way to often. Perhaps use it only if your player box intersects another players box.
10/22/2005 (12:32 pm)
The collision system players (and mobs) use, is designed for maximum efficiency and speed, given that the system is called almost constantly. There are a few 'hitbox' tutorials in the resource section that will expand the possibilities, but they take you only part of the way towards what you want to do. I would first install one of them, getting your chars to the point where they now have additional possible collision boxes. In a few of the raycast functions, you can make a conditional check for when you _might_ want to use these other boxes, should the main stock collision box (mObjBox) signal a collision. Just make sure any initial check you make is extremely efficient, with plenty of chances to 'early out'. If all your conditions exist, you can then check based on the new boxes, which of course fit your char much tighter.
I would not use this for movement itself, thats simply called way to often. Perhaps use it only if your player box intersects another players box.
#3
10/26/2005 (2:26 am)
I made the players bounce off each other to prevent this. May not be the best solution but it works. I haven't had the problem since..
#4
10/26/2005 (3:04 am)
By bounce, you mean what? applying impulses or what not? I have the same thing setup. but they're not allowed to "push" their target enemies in battle, so when they're approaching their targets sometime happens sometimes and they get stuck.
#5
function Armor::onCollision(%this,%obj,%col)
{
%colpos = %col.getPosition();
%objpos = %obj.getWorldBoxCenter();
%imp = vectorSub(%objpos,%colpos);
%imp = vectorScale(%imp,1000);
%obj.applyImpulse("0 0 0",%imp);
%obj.playAudio(2, "bounceSound");
}
10/27/2005 (8:31 pm)
Yeah, im just useing this at the moment..function Armor::onCollision(%this,%obj,%col)
{
%colpos = %col.getPosition();
%objpos = %obj.getWorldBoxCenter();
%imp = vectorSub(%objpos,%colpos);
%imp = vectorScale(%imp,1000);
%obj.applyImpulse("0 0 0",%imp);
%obj.playAudio(2, "bounceSound");
}
#6
10/28/2005 (12:23 am)
Wouldn't that make you bounce of all objects that you collide with?
#7
10/28/2005 (6:34 am)
That would do that. you could limit it by doing a datablock check of what you hit. my characters have a flag on them .canPush and .isPushing for me to do my checks before pushing them back.
Torque Owner Cinder Games
Sure is making issues for my RPG battle system when the character walk into eachother and get stuck... now there's only actually 2 stuck together there.. kinda looks like more.
surely other people have had this problem and wish to discuss possible fixes.