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 ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsCollisionObject3D() CollisionObject3D.Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsPhysicsBody3D() PhysicsBody3D.Instance
- func (self *Extension[T]) AsRigidBody3D() RigidBody3D.Instance
- func (self *Extension[T]) AsVehicleBody3D() Instance
- type ID
- type Instance
- func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance
- func (self Instance) AsRigidBody3D() RigidBody3D.Instance
- func (self Instance) AsVehicleBody3D() Instance
- func (self Instance) Brake() Float.X
- func (self Instance) EngineForce() Float.X
- func (self Instance) ID() ID
- func (self Instance) SetBrake(value Float.X)
- func (self Instance) SetEngineForce(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSteering(value Float.X)
- func (self Instance) Steering() Float.X
- func (self Instance) Virtual(name string) reflect.Value
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 Extension ¶
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]) AsPhysicsBody3D ¶
func (self *Extension[T]) AsPhysicsBody3D() PhysicsBody3D.Instance
func (*Extension[T]) AsRigidBody3D ¶
func (self *Extension[T]) AsRigidBody3D() RigidBody3D.Instance
func (*Extension[T]) AsVehicleBody3D ¶
type 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.
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 (Instance) AsCollisionObject3D ¶
func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance
func (Instance) AsPhysicsBody3D ¶
func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance
func (Instance) AsRigidBody3D ¶
func (self Instance) AsRigidBody3D() RigidBody3D.Instance