VehicleBody3D

package
v0.0.0-...-535787f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

This physics body implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. Aside from a graphics.gd/classdb/CollisionShape3D for the main body of the vehicle, you must also add a graphics.gd/classdb/VehicleWheel3D node for each wheel. You should also add a graphics.gd/classdb/MeshInstance3D to this node for the 3D model of the vehicle, but this model should generally not include meshes for the wheels. You can control the vehicle by using the Instance.Brake, Instance.EngineForce, and Instance.Steering properties. The position or orientation of this node shouldn't be changed directly.

Note: The local forward for this node is [Vector3.ModelFront].

Note: The origin point of your VehicleBody3D will determine the center of gravity of your vehicle. To make the vehicle more grounded, the origin point is usually kept low, moving the graphics.gd/classdb/CollisionShape3D and graphics.gd/classdb/MeshInstance3D upwards.

Note: This class has known issues and isn't designed to provide realistic 3D vehicle physics. If you want advanced vehicle physics, you may have to write your own physics integration using graphics.gd/classdb/CharacterBody3D or graphics.gd/classdb/RigidBody3D.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsVehicleBody3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsCollisionObject3D

func (self *Extension[T]) AsCollisionObject3D() CollisionObject3D.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsPhysicsBody3D

func (self *Extension[T]) AsPhysicsBody3D() PhysicsBody3D.Instance

func (*Extension[T]) AsRigidBody3D

func (self *Extension[T]) AsRigidBody3D() RigidBody3D.Instance

func (*Extension[T]) AsVehicleBody3D

func (self *Extension[T]) AsVehicleBody3D() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.VehicleBody3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsCollisionObject3D

func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsPhysicsBody3D

func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance

func (Instance) AsRigidBody3D

func (self Instance) AsRigidBody3D() RigidBody3D.Instance

func (Instance) AsVehicleBody3D

func (self Instance) AsVehicleBody3D() Instance

func (Instance) Brake

func (self Instance) Brake() Float.X

func (Instance) EngineForce

func (self Instance) EngineForce() Float.X

func (Instance) ID

func (self Instance) ID() ID

func (Instance) SetBrake

func (self Instance) SetBrake(value Float.X)

func (Instance) SetEngineForce

func (self Instance) SetEngineForce(value Float.X)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSteering

func (self Instance) SetSteering(value Float.X)

func (Instance) Steering

func (self Instance) Steering() Float.X

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL