Making AIPlayer slide while colliding and moving forward
by Chris · in Torque 3D Professional · 05/12/2010 (4:58 pm) · 1 replies
Has anyone made a AIPlayer slide when it runs into something it can slide on?
I have path finding implemented but sometimes my AIPlayer hits the edge of something it could slide past if it just moved over a little, like if I have a client run the same path it hits and slides then continues.
I have path finding implemented but sometimes my AIPlayer hits the edge of something it could slide past if it just moved over a little, like if I have a client run the same path it hits and slides then continues.
About the author
Associate Steve Acaster
[YorkshireRifles.com]
I set up a super basic "bounce off" if 2 Ai or Players collide to stop them from getting stuck together - haven't revisited it.
//in aiplayer::onCollision() if (%col.getClassName() $= "AIPlayer" || %col.getClassName() $= "Player") { %colpos = %col.getWorldBoxCenter(); %objpos = %obj.getWorldBoxCenter(); %imp = vectorSub(%objpos,%colpos); %imp = vectorScale(%imp,800);//was 400 %obj.applyImpulse(%col.getWorldBoxCenter(),%imp); }