SDK Vehicle Crash Components

A guide to all vehicle crash components and their usage in the *Hurtworld* SDK.

All crash components run server side, no client(proxy) updates are needed.

**VehicleCrashManager**

Spawns crash vehicles and informs other crash components when to watch for crashes and when to sleep.

This MUST be present for the other crash components to work.

**CrashVehicleSpawnPoint:** Crash vehicle spawn location relative to the vehicles space. (note: not every crash type will use this location, example: the attached body crash will spawn the crash vehicle in the attached body location)

**AttachedBodyCrash**

Attaches another physics body to the vehicle with a joint. If the joint breaks a crash is triggered.
Recommend to inspect the Kanga for correct setup and usage.

**AttachedBody:** reference to the attached physics body

**BreakForce:** force needed to break the joint and trigger a crash

**BreakTorque:** torque needed to break the joint and trigger a crash

**VehicleRigidbody:** reference to the rigidbody of the vehicle

**ThisSeat:** reference to the vehicle seat (VehiclePassenger) this attached body refers to. Each extra passenger needs their own attached body

**Bail Crash**

Whenever a player exits the vehicle if they are over the set speed limit and close to the ground a crash will happen.

**MaxSafeExitSpeed:** the limit over which crashes can happen. Units are meters per second, to convert to km/h multiply by 3.6

**Velocity Direction Crash**

Compares direction of vehicle to direction of velocity. A crash is triggered if velocity is far enough away from the forward direction of the vehicle and vehicle is travelling over a minimum speed.
Used to make the kanga crash when travelling backwards

**VelocityDotForwardLimit:** the direction check uses the dot product formula, this variable is the limit below which a crash can be thrown. 1 is perfectly aligned with vehicle.forward, 0 is orthogonal to vehicle forward, -1 is perfectly aligned with vehicle.back

**MinCrashSpeed:** this crash will only be triggered if vehicle is travelling faster than this limit

**Velocity Change Crash**

When this component updates it takes a snap shot of the vehicles velocity. If the difference between the latest snap shot and the last one is too great then a crash is triggered.

**TimePerUpdate:** how often velocity snap shots are taken in seconds (defaults to 0.1 (10hz))

**DeltaVelocitySqrMagLimit:** Maximum velocity change allowed between snap shots in squared magnitude (ie. distance\*distance)

**Orientation Crash**

Generates crashes based on the vehicles orientation either relative to the worlds up direction or relative to the angle of the ground the vehicle is contacting. Only works whilst the vehicle is on the ground.

**CheckUpDot:** checks the dot product of vehicle.up against world.up when vehicle is grounded

**UpDotLimit:** the limit below which crashes are triggered for the up dot check

**CheckLeanAgainstNormal:** checks the lean of the vehicle relative to the angle of the ground

**LeanLimit:** the lean limit in degrees past which crashes will be triggered

**CheckPitchAgainstNormal:** checks the pitch of the vehicle relative to the angle of the ground

**PitchLimit:** the pitch limit in degrees past which crashes will be triggered. This limit is relaxed as the ground angle becomes steeper or upside down which allows for flips off walls and more consistent behaviour over rough terrain

**Collision Crash**

Triggers crashes based on vehicle collisions.

**UseDirectionalLimits:** checks the direction of collision as well as its size

**SimpleImpulseLimit:** if UseDirectionalLimits is false if a collision force is beyond this magnitude then a crash is triggered

**PositiveCollisionLimits:** if UseDirectionalLimits is true collision forces are transformed into vehicle space and then check that each component of the force vector is less than PositiveCollisionLimits. This makes z - forward, y - up and x - right

**NegativeCollisionLimits:** if UseDirectionalLimits is true collision forces are transformed into vehicle space and then check that each component of the force vector is greater than NegativeCollisionLimits. This makes z - back, y - down and x - left