Jump to content
Sign in to follow this  
RazorX

AI Driving, how to park exactly on a specified location

Recommended Posts

I have a marker set in a town, and I want the AI driver to park its vehicle exactly in that spot. I noticed that when the AI gets closer to the marker for about 3-5 metres, it stops, the move is finished (unitReady).

The marker is set near the road but not strictly adjecent to that road. I also noticed that there is no difference if I set the marker 1m or 5m from the road, it still seems to park right on road's shoulder, too far away from the marker.

I'm using doMove but I also tested other commands, neither one was better.

Any solutions?

ArmA2, 1.07

Share this post


Link to post
Share on other sites

Yeah, I'm now using setPos with unitReady, but I don't want that

Share this post


Link to post
Share on other sites

Is watching the guy park a vital part of the mission? :) Is that exact spot a vital part of the mission?

You might try using the UnitCapture and UnitPlay features, park there yourself then have the AI play it back.

Share this post


Link to post
Share on other sites

If you don't want to setPos (I wouldn't want to either), maybe you could try to doMove there, which isn't accurate enough - sure. But once ready, you could try to setPos there in very small steps. Maybe don't translate linearly, but deaccelerate (log) to make it looke more natural. If you put some time in such a function, I'm sure you could end up with a good looking parking move at an exact position.

Share this post


Link to post
Share on other sites

In old OFP:Resistance, and then again in ArmA1, i had good results if the DoMove destination was set to the exact position of a "road object".

I was using it to let the bus drivers stop exactly at where the bus stations are, etc.

So, before i set the move waypoint (or before i issued the DoMove command), i used nearestObject (don't remember exactly, but i think it was this command) to find nearest road object to the destination and set the waypoint to that coordinates.

I didn't test this method with ArmA2/OA, but i believe it will work the same.

Share this post


Link to post
Share on other sites

Maybe placing an invisible helipad if nothing is quite where you want - seems to work with helicopters at least... more or less anyway.

Share this post


Link to post
Share on other sites
Here's an example mission using UnitCapture and UnitPlay. Consult this thread for more details.

I see, but aren't unitCapture and unitPlay available only for OA? I have basic ArmA2 only.

The problem is that I have parking places set by markers, they are set near each other and I want to make parking maneuvre look realistic (no setPos!) and (the most imprtant) be precise.

Share this post


Link to post
Share on other sites
I see, but aren't unitCapture and unitPlay available only for OA? I have basic ArmA2 only.

The problem is that I have parking places set by markers, they are set near each other and I want to make parking maneuvre look realistic (no setPos!) and (the most imprtant) be precise.

Then you're gonna have to get OA. ;)

Share this post


Link to post
Share on other sites

It's also not much use in an actual game situation as any object that gets in it's way isn't actually taken into account.

It's also quite jerky, at least for me.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

So i Think I'll stand with setPos for now

Glory to realism! :P

Share this post


Link to post
Share on other sites
So i Think I'll stand with setPos for now

Glory to realism! :P

Again, if this isn't good enough for you, then you can always put some more work into this. SetPos (and setDir) from the current position to your precice position in tiny intervals, per interpolation. You may even decide if they should park in backwards if you like.

Share this post


Link to post
Share on other sites
Again, if this isn't good enough for you, then you can always put some more work into this. SetPos (and setDir) from the current position to your precice position in tiny intervals, per interpolation. You may even decide if they should park in backwards if you like.

I already did that, but the effect was nasty. i don't know why, but on sloping terrain the vehicle ended few metres away from the marker.

I calculated the vectorDir from the vehicle to the marker, divided the distance into 20 parts, changed the direction of the vehicle to face the marker and used setPos in a for loop. The effect was so bad, I use only setPos now.

Edited by RazorX

Share this post


Link to post
Share on other sites

Have you tried using velocity, I find in much smoother than setpos and the wheels turn which I don't think they do with setpos.

You do have to use an invisible car and then attach the other to it or the wheels sink in the ground a bit.

Share this post


Link to post
Share on other sites

You could use a trigger with a forcespeed command or an adjusted waypoint. "(vehicle _unit) forcespeed 0"

Share this post


Link to post
Share on other sites

forceSpeed is useless if the unit doesn't even reach its destination

Share this post


Link to post
Share on other sites

That's why you use it with a trigger as a gate to make the vehicle stop as it moves to it's next waypoint or marker. I've done it with a helicopter in a helocast scenario, it should be simpler with a wheeled vehicle.

Edited by mikeyb118

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  

×