Skip to main content

Class PedestrianTrafficBehavior

Specialises TrafficBehaviour for pedestrian actors by routing each sensor detection event to the appropriate TrafficProcess subclass.

public class PedestrianTrafficBehavior : TrafficBehaviour

Inheritance​

Inherited Members​

Remarks​

Pedestrians face a different risk profile than vehicles: their primary threat is oncoming cars, so a Car-layer detection always spawns an AntiCollisionOtherCarsProcess (which halts the pedestrian and waits for the vehicle to clear). Encounters with other pedestrians or mine objects use AntiCollisionOtherObjectProcess instead — a lighter-weight process that does not require a rigidbody parent lookup.

Stopline handling uses the pedestrian-specific tag "Other/Stopline/Pedestrian" rather than the vehicle stopline tag, allowing designers to place pedestrian crossing-wait zones independently of vehicle stoplines within the same intersection.

Methods​

TryGetProcess(GameObject, out TrafficProcess, out ProcessData, out ContactStruct)​

Maps the layer and tag of the sensor-detected object to the appropriate avoidance process.

protected override bool TryGetProcess(GameObject otherObject, out TrafficProcess process, out TrafficProcess.ProcessData processData, out TrafficBehaviour.ContactStruct currentContactValueParameter)

Parameters​

NameTypeDescription
otherObjectGameObjectThe detected object.
processTrafficProcessReceives the newly created process instance.
processDataTrafficProcess.ProcessDataReceives the process initialisation data.
currentContactValueParameterTrafficBehaviour.ContactStructReceives the contact thresholds for this interaction.

Returns​

bool — true if a process was created; false if the object should be ignored.

Remarks​

Layer priority reflects the study's risk hierarchy: the Car layer is checked first because vehicle-pedestrian near-miss events are a primary research focus. For car contacts the parent GameObject is used (rather than the collider itself) because the car's collider may be a child mesh while the rigidbody and actor data live on the root. Mine/Pedestrian layers use the direct object reference. The Stopline layer is only accepted when tagged as the pedestrian variant so that vehicle stoplines in the same intersection do not affect pedestrian movement.

  • Remarks
  • Methods
    • TryGetProcess(GameObject, out TrafficProcess, out ProcessData, out ContactStruct)