Search Results for

    Show / Hide Table of Contents

    Class WheeledVehicle

    Representation of the car vehicle that uses wheels. Built on top of the RigidBody with collider representing its chassis shape and wheels.

    Inheritance
    System.Object
    Object
    SceneObject
    Actor
    RigidBody
    WheeledVehicle
    Implements
    ISerializable
    Inherited Members
    RigidBody.Sleep()
    RigidBody.WakeUp()
    RigidBody.UpdateMass()
    RigidBody.AddForce(Vector3, ForceMode)
    RigidBody.AddForceAtPosition(Vector3, Vector3, ForceMode)
    RigidBody.AddRelativeForce(Vector3, ForceMode)
    RigidBody.AddTorque(Vector3, ForceMode)
    RigidBody.AddRelativeTorque(Vector3, ForceMode)
    RigidBody.SetSolverIterationCounts(Int32, Int32)
    RigidBody.ClosestPoint(Vector3, Vector3)
    RigidBody.IsKinematic
    RigidBody.LinearDamping
    RigidBody.AngularDamping
    RigidBody.EnableSimulation
    RigidBody.UseCCD
    RigidBody.EnableGravity
    RigidBody.StartAwake
    RigidBody.UpdateMassWhenScaleChanges
    RigidBody.MaxAngularVelocity
    RigidBody.Mass
    RigidBody.MassScale
    RigidBody.CenterOfMassOffset
    RigidBody.Constraints
    RigidBody.CenterOfMass
    RigidBody.IsSleeping
    RigidBody.CollisionEnter
    RigidBody.CollisionExit
    RigidBody.TriggerEnter
    RigidBody.TriggerExit
    Actor.SetLayerRecursive(Int32)
    Actor.SetLayerNameRecursive(String)
    Actor.HasTag()
    Actor.HasTag(Tag)
    Actor.HasTag(String)
    Actor.AddTag(Tag)
    Actor.AddTagRecursive(Tag)
    Actor.RemoveTag(Tag)
    Actor.SetParent(Actor, Boolean, Boolean)
    Actor.GetChild(Int32)
    Actor.GetChild(String)
    Actor.GetChild(Type)
    Actor.GetChildren(Type)
    Actor.DestroyChildren(Single)
    Actor.GetScript(Int32)
    Actor.GetScript(Type)
    Actor.GetScripts(Type)
    Actor.AddMovement(Vector3)
    Actor.AddMovement(Vector3, Quaternion)
    Actor.GetWorldToLocalMatrix(Matrix)
    Actor.GetLocalToWorldMatrix(Matrix)
    Actor.OnDebugDraw()
    Actor.OnDebugDrawSelected()
    Actor.GetPrefabRoot()
    Actor.FindActor(String)
    Actor.FindActor(Type, Boolean)
    Actor.FindActor(Type, String)
    Actor.FindActor(Type, Tag, Boolean)
    Actor.FindScript(Type)
    Actor.HasActorInHierarchy(Actor)
    Actor.HasActorInChildren(Actor)
    Actor.IntersectsItself(Ray, Single, Vector3)
    Actor.Intersects(Ray, Single, Vector3)
    Actor.LookAt(Vector3)
    Actor.LookAt(Vector3, Vector3)
    Actor.LookingAt(Vector3)
    Actor.LookingAt(Vector3, Vector3)
    Actor.ToBytes(Actor[])
    Actor.FromBytes(Byte[])
    Actor.FromBytes(Byte[], Dictionary<Guid, Guid>)
    Actor.TryGetSerializedObjectsIds(Byte[])
    Actor.ToJson()
    Actor.FromJson(String)
    Actor.Clone()
    Actor.OnEnable()
    Actor.OnDisable()
    Actor.OnParentChanged()
    Actor.OnTransformChanged()
    Actor.OnActiveChanged()
    Actor.OnActiveInTreeChanged()
    Actor.OnOrderInParentChanged()
    Actor.OnStaticFlagsChanged()
    Actor.OnLayerChanged()
    Actor.OnBeginPlay()
    Actor.OnEndPlay()
    Actor.AddStaticFlags(StaticFlags)
    Actor.RemoveStaticFlags(StaticFlags)
    Actor.SetStaticFlag(StaticFlags, Boolean)
    Actor.HasStaticFlag(StaticFlags)
    Actor.ResetLocalTransform()
    Actor.AddChild(Type)
    Actor.AddChild<T>()
    Actor.GetChild<T>()
    Actor.TryGetChild<T>(T)
    Actor.GetOrAddChild<T>()
    Actor.AddScript(Type)
    Actor.AddScript<T>()
    Actor.GetScript<T>()
    Actor.TryGetScript<T>(T)
    Actor.FindScript<T>()
    Actor.FindActor<T>(Boolean)
    Actor.FindActor<T>(String)
    Actor.FindActor<T>(Tag, Boolean)
    Actor.GetChildren<T>()
    Actor.GetScripts<T>()
    Actor.RotateAround(Vector3, Vector3, Single, Boolean)
    Actor.ToString()
    Actor.Children
    Actor.Tags
    Actor.Layer
    Actor.Name
    Actor.IsActive
    Actor.StaticFlags
    Actor.PerInstanceRandom
    Actor.LocalPosition
    Actor.LocalOrientation
    Actor.LocalScale
    Actor.Sphere
    Actor.Box
    Actor.BoxWithChildren
    Actor.EditorBox
    Actor.EditorBoxChildren
    Actor.HasContentLoaded
    Actor.IsPrefabRoot
    Actor.IsStatic
    Actor.IsTransformStatic
    Actor.WorldToLocalMatrix
    Actor.LocalToWorldMatrix
    SceneObject.SetParent(Actor, Boolean)
    SceneObject.LinkPrefab(Guid, Guid)
    SceneObject.BreakPrefabLink()
    SceneObject.GetNamePath(Char)
    SceneObject.IsDuringPlay
    SceneObject.HasParent
    SceneObject.HasPrefabLink
    SceneObject.PrefabID
    SceneObject.PrefabObjectID
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [ActorContextMenu("New/Physics/Wheeled Vehicle")]
    [ActorToolbox("Physics")]
    [Unmanaged]
    public class WheeledVehicle : RigidBody, ISerializable

    Constructors

    WheeledVehicle()

    Initializes a new instance of the WheeledVehicle.

    Declaration
    public WheeledVehicle()

    Properties

    AntiRollBars

    Sets axles anti roll bars to increase vehicle stability.

    Declaration
    [Unmanaged]
    public WheeledVehicle.AntiRollBar[] AntiRollBars { get; set; }
    Property Value
    WheeledVehicle.AntiRollBar[]

    Differential

    Gets or sets the vehicle differential settings.

    Declaration
    [EditorOrder(7)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public WheeledVehicle.DifferentialSettings Differential { get; set; }
    Property Value
    WheeledVehicle.DifferentialSettings

    DriveControl

    Gets or sets the vehicle drive control settings.

    Declaration
    [EditorOrder(5)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public WheeledVehicle.DriveControlSettings DriveControl { get; set; }
    Property Value
    WheeledVehicle.DriveControlSettings

    DriveType

    Gets or sets the vehicle driving model type.

    Declaration
    [EditorOrder(2)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public WheeledVehicle.DriveTypes DriveType { get; set; }
    Property Value
    WheeledVehicle.DriveTypes

    Engine

    Gets or sets the vehicle engine settings.

    Declaration
    [EditorOrder(6)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public WheeledVehicle.EngineSettings Engine { get; set; }
    Property Value
    WheeledVehicle.EngineSettings

    EngineRotationSpeed

    Gets the current engine rotation speed (Revolutions Per Minute is the number of turns in one minute).

    Declaration
    [Unmanaged]
    public float EngineRotationSpeed { get; }
    Property Value
    System.Single

    ForwardSpeed

    Gets the current forward vehicle movement speed (along forward vector of the actor transform).

    Declaration
    [Unmanaged]
    public float ForwardSpeed { get; }
    Property Value
    System.Single

    Gearbox

    Gets or sets the vehicle gearbox settings.

    Declaration
    [EditorOrder(8)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public WheeledVehicle.GearboxSettings Gearbox { get; set; }
    Property Value
    WheeledVehicle.GearboxSettings

    SidewaysSpeed

    Gets the current sideways vehicle movement speed (along right vector of the actor transform).

    Declaration
    [Unmanaged]
    public float SidewaysSpeed { get; }
    Property Value
    System.Single

    UseAnalogSteering

    If checked, the vehicle driving and steering inputs will be used as analog values (from gamepad), otherwise will be used as digital input (from keyboard).

    Declaration
    [EditorOrder(1)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public bool UseAnalogSteering { get; set; }
    Property Value
    System.Boolean

    UseReverseAsBrake

    If checked, the negative throttle value will be used as brake and reverse to behave in a more arcade style where holding reverse also functions as brake. Disable it for more realistic driving controls.

    Declaration
    [EditorOrder(0)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public bool UseReverseAsBrake { get; set; }
    Property Value
    System.Boolean

    Wheels

    Gets or sets the vehicle wheels settings.

    Declaration
    [EditorOrder(4)]
    [EditorDisplay("Vehicle", null)]
    [Unmanaged]
    public WheeledVehicle.Wheel[] Wheels { get; set; }
    Property Value
    WheeledVehicle.Wheel[]

    Methods

    ClearInput()

    Clears all the vehicle control inputs to the default values (throttle, steering, breaks).

    Declaration
    [Unmanaged]
    public void ClearInput()

    GetThrottle()

    Get the vehicle throttle. It is the analog accelerator pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.

    Declaration
    [Unmanaged]
    public float GetThrottle()
    Returns
    System.Single

    The vehicle throttle.

    GetWheelState(Int32, out WheeledVehicle.WheelState)

    Gets the current state of the wheel.

    Declaration
    [Unmanaged]
    public void GetWheelState(int index, out WheeledVehicle.WheelState result)
    Parameters
    System.Int32 index

    The index of the wheel.

    WheeledVehicle.WheelState result

    The current state.

    SetBrake(Single)

    Sets the input for vehicle brakes. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.

    Declaration
    [Unmanaged]
    public void SetBrake(float value)
    Parameters
    System.Single value

    The value (0,1 range).

    SetHandbrake(Single)

    Sets the input for vehicle handbrake. Handbrake is the analog handbrake value in range (0,1) where 1 represents the handbrake fully engaged and 0 represents the handbrake in its rest state.

    Declaration
    [Unmanaged]
    public void SetHandbrake(float value)
    Parameters
    System.Single value

    The value (0,1 range).

    SetSteering(Single)

    Sets the input for vehicle steering. Steer is the analog steer value in range (-1,1) where -1 represents the steering wheel at left lock and +1 represents the steering wheel at right lock.

    Declaration
    [Unmanaged]
    public void SetSteering(float value)
    Parameters
    System.Single value

    The value (-1,1 range).

    SetTankLeftBrake(Single)

    Sets the input for tank brakes the left track. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.

    Declaration
    [Unmanaged]
    public void SetTankLeftBrake(float value)
    Parameters
    System.Single value

    The value (0,1 range).

    SetTankLeftThrottle(Single)

    Sets the input for tank left track throttle. It is the analog accelerator pedal value in range (-1,1) where 1 represents the pedal fully pressed to move to forward, 0 to represents the pedal in its rest state and -1 represents the pedal fully pressed to move to backward. The track direction will be inverted if the vehicle current gear is rear.

    Declaration
    [Unmanaged]
    public void SetTankLeftThrottle(float value)
    Parameters
    System.Single value

    The value (-1,1 range).

    SetTankRightBrake(Single)

    Sets the input for tank brakes the right track. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.

    Declaration
    [Unmanaged]
    public void SetTankRightBrake(float value)
    Parameters
    System.Single value

    The value (0,1 range).

    SetTankRightThrottle(Single)

    Sets the input for tank right track throttle. It is the analog accelerator pedal value in range (-1,1) where 1 represents the pedal fully pressed to move to forward, 0 to represents the pedal in its rest state and -1 represents the pedal fully pressed to move to backward. The track direction will be inverted if the vehicle current gear is rear.

    Declaration
    [Unmanaged]
    public void SetTankRightThrottle(float value)
    Parameters
    System.Single value

    The value (-1,1 range).

    SetThrottle(Single)

    Sets the input for vehicle throttle. It is the analog accelerator pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.

    Declaration
    [Unmanaged]
    public void SetThrottle(float value)
    Parameters
    System.Single value

    The value (-1,1 range). When using UseReverseAsBrake it can be negative and will be used as brake and backward driving.

    Setup()

    Rebuilds the vehicle. Call it after modifying vehicle settings (eg. engine options).

    Declaration
    [Unmanaged]
    public void Setup()

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)

    See Also

    RigidBody
    In This Article
    • Constructors
      • WheeledVehicle()
    • Properties
      • AntiRollBars
      • Differential
      • DriveControl
      • DriveType
      • Engine
      • EngineRotationSpeed
      • ForwardSpeed
      • Gearbox
      • SidewaysSpeed
      • UseAnalogSteering
      • UseReverseAsBrake
      • Wheels
    • Methods
      • ClearInput()
      • GetThrottle()
      • GetWheelState(Int32, out WheeledVehicle.WheelState)
      • SetBrake(Single)
      • SetHandbrake(Single)
      • SetSteering(Single)
      • SetTankLeftBrake(Single)
      • SetTankLeftThrottle(Single)
      • SetTankRightBrake(Single)
      • SetTankRightThrottle(Single)
      • SetThrottle(Single)
      • Setup()
    • Extension Methods
    • See Also
    Back to top Copyright © 2012-2024 Wojciech Figat