Collision avoidance
by gamer · in Torque Game Engine · 09/17/2007 (6:50 pm) · 3 replies
I need to simulate crowd/mob behavior where people might run into each other, get stuck on the wall/curb/other obstacle. What's the best way of doing this kind of collision avoidance?
any advise is welcome.
thanks
any advise is welcome.
thanks
About the author
#2
this bounces when they collide, what about avoid collision?
09/17/2007 (9:17 pm)
Great source, thanks!this bounces when they collide, what about avoid collision?
#3
If you need AI that is smart enough to NOT run into things, thats a more difficult problem...
EDIT:
Ok, here is a good start on AI script/programing;
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3782
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6773
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6742
You would need to study the above, and fit it into what you need, but most of it is already there for you.
09/17/2007 (9:24 pm)
You mean, as in NO collision at all? There is a resource here that allows one to turn off collision mesh by script.If you need AI that is smart enough to NOT run into things, thats a more difficult problem...
EDIT:
Ok, here is a good start on AI script/programing;
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3782
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6773
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6742
You would need to study the above, and fit it into what you need, but most of it is already there for you.
Torque 3D Owner Caylo Gypsyblood
%HITCLASS = %collidedObject.getclassname(); %HITOBJ = %collidedObject; //!NO! BOUNCE OFF for....... if ( %HITCLASS $= "TerrainBlock") return; if ( %HITCLASS $= "RigidShape") return; if ( %HITCLASS $= "Player" ) return; //Figure in a BOUNCE OFF direction %kickBack = -1500 ; // How much to BOUNCE OFF might try to scale with%vecLen %dir = %obj.getForwardVector(); %position = getWords(%obj.getTransform(), 0, 2); %x1 = getWord(%dir, 0) * %kickBack; %y1 = getWord(%dir, 1) * %kickBack; %z1 = getWord(%dir, 2) * %kickBack; %impulseVec = %x1 SPC %y1 SPC %z1; %obj.applyImpulse(%position, %impulseVec);You can setup situation for any number of %HITCLASS objects, or even an specific %HITOBJ.