Jump to content
Sign in to follow this  
Kydoimos

AI Driving / Collisions

Recommended Posts

Hi all - just a quick question, I'm not sure if it's feasible - but...

I was wondering if one can force a vehicle to move along the road despite a unit being on it. Essentially, I want to disable whatever it is that forces the object to stop, because it detects it will collide with another object. Ordinarily, I'd just use the unitCapture function, but as we all know, it doesn't work well on land based vehicles. The problem I'm trying to resolve, is to have a vehicle stop at a checkpoint when the AI's driving. Unfortunately, because there are units at the checkpoint, it is causing some odd behaviour and the vehicle does not stop very close to them. Either that, or the vehicle goes off the road, or veers to one side. Any ideas? :D Thanks as always, in advance guys!

Share this post


Link to post
Share on other sites

I wish to have even that degree of the control over AI... AFAIK there's nothing like VBS' remote control commands nor such aspects of AI to disable from scripts. Not sure, if any use of doMove here... Maybe some peculiar usage of setVelocity? And even in VBS IIRC AI driven vehicles tend to be exaggerated scare about objects only near to the driving path... Maybe if the unit would be only a dummy, not real object... I saw somewhere some exotic ways of generating visible 3D objects using particle effect commands for example but that's seem extreme even if still possible.

Of course, that doesn't prevent AI cars from ramming to death pedestrians along the road... :/

---------- Post added at 11:13 ---------- Previous post was at 10:17 ----------

Here's exemplary use of setVelocity for makeshift workaround. More a joke, than real solution, but anyway. :) The code used:

_angTowards = 
{
private ["_source0", "_target0", "_dX0","_dY0","_angleAzimuth0"];
_source0 = _this select 0;
_target0 = _this select 1;

_dX0 = (_target0 select 0) - (_source0 select 0);
_dY0 = (_target0 select 1) - (_source0 select 1);

_angleAzimuth0 = _dX0 atan2 _dY0;

_angleAzimuth0
};

sleep 2;

_pos = position u1;

c1 doMove _pos;

waitUntil 
{
sleep 0.01;

((c1 distance _pos) < 35)
};

_vel = velocity c1;
_speed = _vel vectorDistance [0,0,0];

doStop c1;

while {((c1 distance _pos) > 4)} do
{
if (((velocity c1) vectorDistance [0,0,0]) < _speed) then
	{
	_dir = [position c1,_pos] call _angTowards;
	c1 setDir _dir;
	c1 setVelocity _vel;
	};

//sleep 0.001
};

_vel = velocity c1;

c1 setVelocity [(_vel select 0)/10,(_vel select 1)/10,(_vel select 2)/10];

Edited by Rydygier

Share this post


Link to post
Share on other sites

I can't test this right now, so I'm not sure if it will help, but try disableAI "FSM" on the driver.

Share this post


Link to post
Share on other sites

Seems, whatever, for driver or car itself, disabling FSM does nothing here. IMO because AI driving behavior is coded deeper, than level of some FSM, we could turn off using this command.

Share this post


Link to post
Share on other sites

Thanks chaps! :D Funnily enough, setVelocity might be the way to go! Cheers guys!

Share this post


Link to post
Share on other sites

How about positioning the truck manually onEachFrame, when it is close enough to the checkpoint. Correct direction and wheels rolling correctly is a challenge though.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×