Any suggestions for ai steering???

Posted By: raiden

Any suggestions for ai steering??? - 02/20/06 05:08

Currently I am working with a couple of ai cars, my goal of course is to get them to steer to wed path nodes correctly. I have been tweaking the steering parameters alot, and have not found a good solution.

Any suggestions would help, here is how I am trying to achieve smooth turning to nodes:
Code:

//ai helper functions
function TurnToNode() {
vec_to_angle(my.ang_pan,my.node_targ_x);
my._ang_dis = ang((my.pan%360) - (my.ang_pan%360));
if(int(my._ang_dis) > 0) {
p1carsteer.x = min(1.0,p1carsteer.x+0.2*time);
p1carsteer.y = min(1.0,p1carsteer.y+0.2*time);
p1carsteer.z = 0;
phcon_setmotor(frw_p1id,p1carsteer,nullvector,nullvector);
phcon_setmotor(flw_p1id,p1carsteer,nullvector,nullvector);
}
if(int(my._ang_dis) < 0) {
p1carsteer.x = max(-1.0,p1carsteer.x-0.2*time);
p1carsteer.y = max(-1.0,p1carsteer.y-0.2*time);
p1carsteer.z = 0;
phcon_setmotor(frw_p1id,p1carsteer,nullvector,nullvector);
phcon_setmotor(flw_p1id,p1carsteer,nullvector,nullvector);
}
}



The front tires steering distances are set as:
Code:

phcon_setparams2(flw_p1id,vector(-30,30,0),nullvector,vector(80000,200,0));


Thanks for your help.

-raiden
Posted By: Marco_Grubert

Re: Any suggestions for ai steering??? - 02/21/06 21:49

This looks like a good start. You should add differential steering since both wheels do not need to be turned at the same rate. Make sure you change the active node early to prevent cars from circling around a node when they get too close.
© 2024 lite-C Forums