Class PhysicVehicle3D
This component represents a physical vehicle.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework.Physics3D
Assembly: Evergine.Framework.dll
Syntax
public class PhysicVehicle3D : Component, IDependencyObject
Fields
ChassisBody
The RigidBody associated with the vehicle.
Declaration
[BindComponent(true, true, BindComponentSource.Owner, null, true)]
public RigidBody3D ChassisBody
Field Value
| Type | Description |
|---|---|
| RigidBody3D |
Transform3D
The transformation of the vehicle.
Declaration
[BindComponent(true, true, BindComponentSource.Owner, null, true)]
public Transform3D Transform3D
Field Value
| Type | Description |
|---|---|
| Transform3D |
Properties
ChassisWorldTransform
Gets the chassis world transform.
Declaration
public Matrix4x4 ChassisWorldTransform { get; }
Property Value
| Type | Description |
|---|---|
| Matrix4x4 |
FrictionSlip
Gets or sets the friction slip.
Declaration
public float FrictionSlip { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
InternalRigidBody
Gets the internal rigid body.
Declaration
public IRigidBody3D InternalRigidBody { get; }
Property Value
| Type | Description |
|---|---|
| IRigidBody3D |
MaxSuspensionForce
Gets or sets the maximum suspension force.
Declaration
public float MaxSuspensionForce { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MaxSuspensionTravel
Gets or sets the maximum suspension travel in meters.
Declaration
public float MaxSuspensionTravel { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
NumWheels
Gets the number of wheels.
Declaration
public int NumWheels { get; }
Property Value
| Type | Description |
|---|---|
| int |
SuspensionCompression
Gets or sets the suspension compression.
Declaration
public float SuspensionCompression { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
SuspensionDamping
Gets or sets the suspension damping.
Declaration
public float SuspensionDamping { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
SuspensionStiffness
Gets or sets the suspension stiffness.
Declaration
public float SuspensionStiffness { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
ApplyEngineForce(float)
Apply the engine force from the specified wheel.
Declaration
public void ApplyEngineForce(float force)
Parameters
| Type | Name | Description |
|---|---|---|
| float | force | The engine force to be applied. |
Remarks
The engine force will be applied to all drive wheels.
CastRay(ref Vector3, ref Vector3, ref VehicleRaycasterResult)
This method performs a raycast to simulate car suspension. The default implementation is a simple raycast.
Declaration
public virtual IPhysicBody3D CastRay(ref Vector3 from, ref Vector3 to, ref PhysicVehicle3D.VehicleRaycasterResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | from | The starting point of the raycast. |
| Vector3 | to | The ending point of the raycast. |
| PhysicVehicle3D.VehicleRaycasterResult | result | The raycast result. |
Returns
| Type | Description |
|---|---|
| IPhysicBody3D | The hit body. |
OnActivated()
Invoked when the object is activated once it is attached.
Declaration
protected override void OnActivated()
Overrides
OnDeactivated()
Invoked when the object is deactivated.
Declaration
protected override void OnDeactivated()
Overrides
SetBrake(float)
Set the braking force in the vehicle.
Declaration
public void SetBrake(float brake)
Parameters
| Type | Name | Description |
|---|---|---|
| float | brake | The braking force to be applied. |
Remarks
The brake value will be set to all brakable wheels.
SetSteeringValue(float)
Sets the steering value of the vehicle.
Declaration
public void SetSteeringValue(float steering)
Parameters
| Type | Name | Description |
|---|---|---|
| float | steering | The steering value to be applied. |
Remarks
The steering value will be applied to all steering wheels.