Is there a way to have simobjects avoiding collisions with each other?

Hello! I’m using Mission file scripts
(https://docs.flightsimulator.com/html/index.htm#t=Content_Configuration%2FFlights_And_Missions%2FMission_Definitions.htm)
to create custom ground traffic around an airport. Traffic that is not
connected to gate services around the gates but rather ground traffic like
buses, landside cars, animals etc. (haven’t checked but I think the problem
described applies to services also). Is there a way to have them yield to each
other and avoid collisions? Sadly they always run though each other. The
“YieldToUser” tag doesn’t work here as this only applies to user aircraft but
not AI objects to each other. Works fine yielding to aircraft, but creates the
problem that when 2 or more simobjects yield for user aircraft following the
same path, they will always collide with each other (or rather “merging into
each other”) instead of the 2nd one stopping a few meters behind the 1st one
yielding the aircraft. Another idea was to possibly use something like a but
this one isn’t documented yet (see link above), so I don’t know if this would
be the right approach. Thanks!

How do you have you simobject set up? Maybe try setting the AIType to
GroundVehicle. Or try setting up your simobject like ASO_TruckUtility01

As far as I can see it is exactly set up same same way as ASO_TruckUtility01
and is also set to AIType=GroundVehicle. Here’s the content of the applicable
files: Model XML (LS_VH_Anim_005.xml) of simobject:

LS_VH_Anim_005_Rotation
0.31 



LS_VH_Anim_005_Orientation
-1 
50 

sim.cfg:

[VERSION]
Major=1
Minor=0

[fltsim.0]
title=LS_VH_Anim_005
model=""
texture=""

[General]
category=GroundVehicle
DistanceToNotAnimate=2000

[PILOT]
pilot_default_animation = "Driving_GPU"
pilot_attach_node = "PILOT_0"

[contact_points]
wheel_radius=3.15
static_pitch=0.0                ;degrees, pitch when at rest on the ground (+=Up, -=Dn)
static_cg_height=0              ;feet, altitude of CG when at rest on the ground

[DesignSpecs]
max_speed_mph = 50     
acceleration_constants = 0.3, 0.4     ;Time constant (effects responsiveness), and max G acceleration
deceleration_constants = 0.2, 0.4     ;Time constant (effects responsiveness), and max G acceleration
turning_constants = 2.0, 45, 4.0, 15.0 ;Time constant (effects responsiveness), max deg/s acceleration, optimal (knots) turning speed, max (knots) turning speed


[WAYPOINT]
StopDistance = 0.6

[TAXI]
DistanceToLaneLine = 2.0

[LIGHTS]
newlight.0 = HeadLight, Headlight_R, Headlight_Mesh, Headlight_Emi
newlight.1 = HeadLight, Headlight_L, Headlight_Mesh, Headlight_Emi
newlight.6 = BackLight, BackLight_R, Backlight_Mesh, Backlight_Emi
newlight.7 = BackLight, BackLight_L, Backlight_Mesh, Backlight_Emi

LS_AI_Landside.xml (SPB source XML calling above simobject in 2 instances
following the same path in opposite direction - you will see that they don’t
avoid each other):

    LS_AI_Landside.xml
    



        
            none
            LS_VH_Anim_005
            True
            0.000,0.000,0.000,0.000
            0.000,0.000,0.000
GroundVehicle
            -1
            AI
            
                6.000
                3.000
                4.000
                True
                False
                True
                
                    True
                    0
                    False
                    False
                    True
                    
                        Waypoint 001
                        001
                        0.000,0.000,0.000,0.000
                        True
                        False
                    
                    
                        Waypoint 002
                        002
                        100.000,0.000,0.000,0.000
                        True
                        False
                    
                
            
        



        
            none
            LS_VH_Anim_008
            True
            100.000,0.000,0.000,0.000
            0.000,0.000,0.000
GroundVehicle
            -1
            AI
            
                6.000
                3.000
                4.000
                True
                False
                True
                
                    True
                    0
                    False
                    False
                    True
                    
                        Waypoint 001
                        001
                        100.000,0.000,0.000,0.000
                        True
                        False
                    
                    
                        Waypoint 002
                        002
                        0.000,0.000,0.000,0.000
                        True
                        False

I still have to explore simobjects in the SDK, so I am not 100% sure how to
get this to work. Some things to try in LS_AI_Landside.xml : Add a ground
vehicle pilot to the containers:

                GroundVehicle_Pilot

Set the AI to taxi mode:

                Taxi
                ...

You can debug simobjects in the devmode with
Options>Simobjects>GROUND_VEHICLE There you can look at the state of the AI
and the path it wants to take. As for the proximity trigger, you could use a
trigger area that moves along with the simobject and detects any objects close
to it, but I don’t now how you can get the simobject to stop when the trigger
fires, except for just de-activating the simobject entirely. You can find
documentation for the proximityTrigger and more script elements on the
FSDeveloper
Wiki
. I am
still working on it and it is not complete, but hopefully it can help you. You
can also add to the wiki if you find something out that is not yet documented.

Adding a GroundVehicle_Pilot didn’t have any effect at all. Adding Taxi causes
the waypoint following to halt at the very beginning. I need to look into the
proximity trigger but I already have a hard time using it for vehicles to stop
when they reach a certain static rectangle (sometimes works, sometimes the
animation just stops at random somewhere).

Hi Jayshrike, I am interested in doing what you suggest, i.e. [quote=“Jayshrike, post:4, topic:3570”]
As for the proximity trigger, you could use a
trigger area that moves along with the simobject and detects any objects close
to it,
[/quote]
I have tried attaching a ProximityTrigger to a GroundVehicle which is itself running on a Waypoint path.
I have merged two separate WorldScripts (one for Waypoints and one for Proximity Trigger. No compilation errors and all parameters seem to be correct.
But I can’t even see the Rectangle Area when I debug World Objects.
Could it be that Proximity Trigger rectangles can only be attached to Landmark SimObjects?
Thanks for any clarifications or even a working example. :smiley:
EDIT:
I found it! Works beautifully - I had merged a Waypoint script with a Proximity script but I had messed up with the SimContainer reference GUID.
All is well - so happy! :smiley:

1 Like