diff options
Diffstat (limited to 'doc/classes/VehicleBody.xml')
-rw-r--r-- | doc/classes/VehicleBody.xml | 96 |
1 files changed, 8 insertions, 88 deletions
diff --git a/doc/classes/VehicleBody.xml b/doc/classes/VehicleBody.xml index 48202665fb..3ce0cadde9 100644 --- a/doc/classes/VehicleBody.xml +++ b/doc/classes/VehicleBody.xml @@ -1,108 +1,28 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="VehicleBody" inherits="PhysicsBody" category="Core" version="3.0.alpha.custom_build"> +<class name="VehicleBody" inherits="RigidBody" category="Core" version="3.1"> <brief_description> + Physics body that simulates the behaviour of a car. </brief_description> <description> + This nodes implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a [CollisionShape] for the main body of your vehicle and add [VehicleWheel] nodes for the wheels. You should also add a [MeshInstance] to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the [member brake], [member engine_force], and [member steering] properties and not change the position or orientation of this node directly. + Note that the origin point of your VehicleBody will determine the center of gravity of your vehicle so it is better to keep this low and move the [CollisionShape] and [MeshInstance] upwards. </description> <tutorials> </tutorials> <demos> </demos> <methods> - <method name="get_brake" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_engine_force" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_friction" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_linear_velocity" qualifiers="const"> - <return type="Vector3"> - </return> - <description> - Returns the VehicleBody's velocity vector. To get the absolute speed in scalar value, get the length of the return vector in pixels/second. Example: - [codeblock] - # vehicle is an instance of VehicleBody - var speed = vehicle.get_linear_velocity().length() - [/codeblock] - </description> - </method> - <method name="get_mass" qualifiers="const"> - <return type="float"> - </return> - <description> - </description> - </method> - <method name="get_steering" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the steering angle (in radians). - </description> - </method> - <method name="set_brake"> - <return type="void"> - </return> - <argument index="0" name="brake" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_engine_force"> - <return type="void"> - </return> - <argument index="0" name="engine_force" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_friction"> - <return type="void"> - </return> - <argument index="0" name="friction" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_mass"> - <return type="void"> - </return> - <argument index="0" name="mass" type="float"> - </argument> - <description> - </description> - </method> - <method name="set_steering"> - <return type="void"> - </return> - <argument index="0" name="steering" type="float"> - </argument> - <description> - Set the steering angle (in radians). - </description> - </method> </methods> <members> <member name="brake" type="float" setter="set_brake" getter="get_brake"> + Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking. </member> <member name="engine_force" type="float" setter="set_engine_force" getter="get_engine_force"> - </member> - <member name="friction" type="float" setter="set_friction" getter="get_friction"> - </member> - <member name="mass" type="float" setter="set_mass" getter="get_mass"> + Accelerates the vehicle by applying an engine force. The vehicle is only speed up if the wheels that have [member VehicleWheel.set_use_as_traction] set to true and are in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration. Note that the simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears. + A negative value will result in the vehicle reversing. </member> <member name="steering" type="float" setter="set_steering" getter="get_steering"> + The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel.set_use_as_steering] set to true will automatically be rotated. </member> </members> <constants> |