CreateVehicleBody()

Syntax

CreateVehicleBody(#Entity, Mass.f, Restitution.f, Friction.f [, SuspensionStiffness.f, SuspensionCompression.f, SuspensionDamping.f, MaxSuspensionCompression.f, Friction.f)
Description
Creates a physic body associated with the vehicle #Entity.

To have its collisions managed by the physic engine, an entity has to set a body. In fact, only the body is known by the physic engine, which will do all the calculation about the entity, check the mass, friction and if it collides will move back the real entity.

To have any effect, the physic engine needs to be activated with the EnableWorldPhysics().

Parameters

#Entity The vehicle entity to use.
Mass Mass of the vehicle. Don't use too big value or it could produce physic incoherencies (1 is the preferred value).
Restitution Restitution of the vehicle. This value can also be get or set via GetEntityAttribute() and SetEntityAttribute()
Friction Friction of the vehicle. This value can also be get or set via GetEntityAttribute() and SetEntityAttribute()
SuspensionStiffness (optional) The stiffness value for the suspension (10: Offroad buggy, 50: Sports car, 200: F1 Car)
SuspensionCompression (optional) The damping coefficient to use when the suspension is compressed. Sets to value * 2 * SquareRoot(SuspensionStiffness), so it is proportional to critical damping. Value examples:
  value = 0: undamped & bouncy
  value = 1: critical damping
Recommanded values are from 0.1 to 0.3.
SuspensionDamping (optional) The damping when the suspension is expanding. See the SuspensionCompression to know how to set this value. SuspensionDamping should be slightly larger than SuspensionCompression. Recommanded values are from 0.2 to 0.5.
MaxSuspensionCompression (optional) The length the suspension can be compressed (in centimeters).
Friction (optional) The friction between the tyre and the ground. Should be about 0.8 for realistic cars, but can increased for better handling. A large value (10000.0) can be used for kart racers like handling.

Return value

None.

See Also

FreeEntityBody()

Supported OS

All

<- CreateVehicle() - Vehicle Index - GetVehicleAttribute() ->