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
- TrafficBehaviour.searchAreaSensor
- TrafficBehaviour.keepDistanceOtherCarsAreaSensors
- TrafficBehaviour.trafficObjectContactParameter
- TrafficBehaviour.stoplineContactParameter
- TrafficBehaviour.KeepDistanceSensors
- TrafficBehaviour.CanProcessTraffic
- TrafficBehaviour.Processes
- TrafficBehaviour.IsHijacked
- TrafficBehaviour.SetController(Object)
- TrafficBehaviour.Start()
- TrafficBehaviour.OnDestroy()
- TrafficBehaviour.DoUpdate()
- TrafficBehaviour.CheckCanAddedProcess(TrafficProcess)
- TrafficBehaviour.OnSearchAreaSensorDetected(Collider)
- TrafficBehaviour.OnKeepDistanceSensorDetected(Collider)
- TrafficBehaviour.TryGetProcess(GameObject, out TrafficProcess, out TrafficProcess.ProcessData, out TrafficBehaviour.ContactStruct)
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
| Name | Type | Description |
|---|---|---|
otherObject | GameObject | The detected object. |
process | TrafficProcess | Receives the newly created process instance. |
processData | TrafficProcess.ProcessData | Receives the process initialisation data. |
currentContactValueParameter | TrafficBehaviour.ContactStruct | Receives 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.