Jump to content
_leech

Disabling collision avoidance for vehicles

Recommended Posts

I want to disable collision avoidance for one specific ai/vehicle.

 

I'd like to hear from anyone who knows how to do this.

 

Thanks alot

Share this post


Link to post
Share on other sites

player disableCollisionWith myChopper;

 

Google is your friend.  A search for "arma 3 disable collision"  would have gotten you there pretty quick.

  1. He wanted to disable collision avoidance, not collosion.
  2. Aren't all vehicles PhysX objects?

You'd either have to mess with some FSM files or it's impossible, I guess.

Share this post


Link to post
Share on other sites

That isn't really a complete answer.  In general I think you could loop checking nearObjects and applying/removing the disableCollisionWith effect when things came in and out of range, but it might take some fiddling.

 

Saw the above post, I guess that's true, I had assumed the OP misspoke but I think theend3r is right.

Share this post


Link to post
Share on other sites

I want a vehicle driving on a road not avoiding the objects that's on that road.

 

Here's something i found in another topic:

 

class AICarSteeringComponent
{
steeringPIDWeights[] = { 2.0, 0.2, 0.0 };
speedPIDWeights[] = { 0.5, 0.2, 0.0 };
doRemapSpeed = true;
remapSpeedRange[] = { 10.0. 90.0 };
remapSpeedScalar[] = { 1.0, 0.35 };
doPredictForward = true;
predictForwardRange[] = { 1, 20 };
steerAheadSaturation[] = { 0.01, 0.4 };
speedPredictionMethod = 2;
wheelAngleCoef = 0.7;
forwardAngleCoef = 0.7;
steeringAngleCoef = 1.0;
differenceAngleCoef = 1.0;
stuckMaxTime = 3.0;
allowOvertaking = true;
allowDrifting = false;
allowCollisionAvoidance = true;
maxWheelAngleDiff = 0.2616;
minSpeedToKeep = 0.1;
};

 

from https://forums.bistudio.com/topic/191515-ai-driving-feedback-topic/?hl=collisionavoidance

 

Does anyone know how to use allowCollisionAvoidance = false; on one specific vehicle?

 

Or just anything similar that works.

Share this post


Link to post
Share on other sites

Sorry, I misunderstood the question.  If purpose of this close drive-by of a near vehicle is for eye-candy only (i.e., you don't need player or AI to get in the vehicle being avoided), then you can try:

myVehicleToAvoid enableSimulation false;

I'm thinking the AI will ignore this object entirely if simulation disabled.  If you do need the object to be active before/after the drive-by, you could disable simulation only when then driving vehicle approaches, and re-enable after it passes.  You would have to figure out what the threshold distance is before AI detects and starts steering away from the vehcle.

 

If the player has to be in the vehicle being avoided this will not work.  Please post your solution when you get one!

Share this post


Link to post
Share on other sites

I need a car/convoy that drives in a loop and at some point it has to drive through a spot with containers on each side of the road. But even though there's lots of space on the road the ai still drives off the road and around the containers. I need the ai to ignore the objects so that it wont drive around them.

 

myVehicleToAvoid enableSimulation false;

I'm not sure if this will work?

Share this post


Link to post
Share on other sites

I would definitely try my suggestion.  AI will not shoot, target or acknowledge enemey AI units that have simulation set to false.  So it seems likely that AI drivers would also ignore disabled objects when driving.

 

Just put this in the init fields of the containers for a quick test:

this enableSimulation false;

If it works, you can make a trigger that disables/enables simulation of these objecgts when the convoy enters/exitis the trigger area.  That way the containers would be disabled only when convoy near.

 

Arma is frequently frustrating like this, and you have to experiment and do workarounds.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks alot johnnyboy. This works very nicely.

 

For some reason the ai is still slightly affected by the objects, and you might have to place the objects right so that there's no collision. But when you have done that, it works flawlessly.

 

Thanks for the help!

  • Like 1

Share this post


Link to post
Share on other sites

Glad I could help sir.  Enjoy the armaverse!  And remember it helps others to mark this issue as [sOLVED] in the thread title.

Share this post


Link to post
Share on other sites

Actually I just might need some more help.

 

I just got a new problem. At the end of the road with the containers on each side, there needs to be an object blocking that tunnel. When i place an object there, the vehicle turns to the side.

 

Even with the "this enableSimulation false;" in that object.

 

Is there ANY way to make an object totally invisible to an ai?

Share this post


Link to post
Share on other sites

try putting a small object like the dented can in the road,  Then attach (attachTo) command the blocking object to it.  The attached blocking object should have simulation turned off.  I believe AI may ignore attached objects.  Be sure the small object (can) does not disturb the AI driving first.  If it does, move it 100 meters in some direction away from the blocking position.  Then when you attach the blocking object, adjust the attached relative position by that 100 meters so blocking object appears in tunnel where you want it.  Might work.

Share this post


Link to post
Share on other sites

The small dented can apparently totally stops the vehicle :)

 

The problem is, that it is part of the mission that road barriers have to be manually dragged onto the road via ace dragging.

 

I use it like this "this attachTo [roadthing];" is that right?

 

Also, using "this enableSimulation false;" on the road barriers is kinda too bad because it turns off all physics and the ability for them to be knocked over.

Share this post


Link to post
Share on other sites

So you want the vehicle to crash through the barriers?

 

If that is the case, turn off simulation on them until moving vehicle close (so vehicle does not steer away), then with a trigger sense when vehicle is about to hit them and turn simulation back on.  You may also have to use a loop (for a second or too) to setvelocity on vehicle to be sure they crash through.  Capture current velocity before trigger activated, and use that velocity for setvelocity in the loop.  That should keep vehicle moving at same speed and direction through the barriers.

 

End the loop, and hopefully if barriers now behind vehicle they will resume driving normally.

 

With SetVelocity in a loop you can force a vehicle in any direction at any speed.  Problem with land vehicles is wheel spinning animation won't play, but for a short duration move it won't matter.

Share this post


Link to post
Share on other sites

I don't necessarily want it to crash with it but if it should happen i'd like it to have the physics effect.

 

I already got a trigger attached to the road barriers that will force the vehicle to stop when it's a certain distance from the barriers and only when the barriers are on the road.

 

Only thing i want is that the vehicle drives up to the barriers and stops without turning to sides or trying to drive around.

Share this post


Link to post
Share on other sites

I don't necessarily want it to crash with it but if it should happen i'd like it to have the physics effect.

 

I already got a trigger attached to the road barriers that will force the vehicle to stop when it's a certain distance from the barriers and only when the barriers are on the road.

 

Only thing i want is that the vehicle drives up to the barriers and stops without turning to sides or trying to drive around.

Then I would still disable barriers before driver gets close enough to barriers to react and veer.  Then re-enable them when vehicle stops, or is really close to barriers (5 meters or less maybe).

Share this post


Link to post
Share on other sites

Ok just wanted to give an update on the barriers/convoy. Turned out not using any triggers at all (and only using "this enableSimulation false;" on the objects on each side of the road) works pretty fine. It just takes some adjusting of the objects to make the convoy stop and not crash into something or turn to the side (when using the barriers). It would still be nice to know if there's any way at all to totally turn off CollisionAvoidance or make objects totally invisible for the ai.

But for now (and once the objects are in place), this works very good.

  • Like 1

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

×