TurretSeat ​
The seat of a gunner: a turret on the model that follows where the rider aims. A player aims with the camera; an AI (a TurretSeatAI) aims at its target. The turret is a node of the model of the mount (found by its name) that turns on its vertical axis, and an optional barrel node that tilts. The abilities of the seat (its action bar slots) are the guns.
Description ​
Make your own seat by extending this one, or Seat (see Advanced).
Properties ​
String | turret_node_name | "Turret" |
String | barrel_node_name | "" |
float | yaw_limit_degrees | 180.0 |
float | pitch_min_degrees | -10.0 |
float | pitch_max_degrees | 45.0 |
float | turn_speed_degrees | 120.0 |
bool | aim_with_camera | true |
Variables ​
float | current_yaw | 0.0 |
float | current_pitch | 0.0 |
Methods ​
String | get_seat_type_name() |
String | get_seat_type_description() |
Dictionary | get_field_descriptions() |
Dictionary | save_state() |
void | load_state( state: Dictionary ) |
void | on_enter( p_session: MountSession ) |
void | aim_at( world_point: Vector3 ) |
void | aim_in_direction( direction: Vector3 ) |
bool | is_aimed( tolerance: float ) |
Vector3 | get_aim_direction() |
void | process( _input: Vector2, delta: float ) |
Property descriptions ​
String turret_node_name = "Turret" ​
The node of the mount model that turns left and right (found by its name under the mount). Empty or missing: nothing turns, but the seat still knows where it aims
String barrel_node_name = "" ​
The node that tilts up and down (the barrel). Empty: none
float yaw_limit_degrees = 180.0 ​
How far the turret can turn to each side of the front of the mount (degrees). 180 = all the way round
float pitch_min_degrees = -10.0 ​
How far the barrel can tilt down and up (degrees)
float pitch_max_degrees = 45.0 ​
No description yet.
float turn_speed_degrees = 120.0 ​
How fast the turret turns (degrees per second)
bool aim_with_camera = true ​
A player aims where the camera looks
Variable descriptions ​
float current_yaw = 0.0 ​
The yaw (relative to the front of the mount) and pitch the turret has now, in radians
float current_pitch = 0.0 ​
No description yet.
Method descriptions ​
String get_seat_type_name() ​
What this kind of seat is called in the editor list (from Seat)
String get_seat_type_description() ​
A sentence about what this kind of seat does, for the editor (from Seat)
Dictionary get_field_descriptions() ​
The sentences the editor shows as tooltips: {name of an exported variable: text}. A seat of your own adds its variables (call super and merge) (from Seat)
Dictionary save_state() ​
What the seat keeps for a save (a game that is loaded while a rider sits puts it back before the rider sits down): the abilities it granted, and what your own seat adds. Override it (call super and merge) to keep a state of your own, and load_state to read it (from Seat)
void load_state( state: Dictionary ) ​
Reads what save_state gave. Called before on_enter when a game is loaded (from Seat)
void on_enter( p_session: MountSession ) ​
A rider sat down. Override for your own setup and call super (from Seat)
void aim_at( world_point: Vector3 ) ​
Aims at a point of the world (what an AI does). The turret turns towards it on the next frames
void aim_in_direction( direction: Vector3 ) ​
Aims in a direction of the world
bool is_aimed( tolerance: float ) ​
Does the turret point at what it aims at, within this angle (radians)?
Vector3 get_aim_direction() ​
The direction the turret points in, in the world
void process( _input: Vector2, delta: float ) ​
Every physics frame while the rider sits. input is the move keys (x right, y forward) of the player that controls the rider, zero when it does not. Override for a turret that follows the camera, a seat that drains a resource, and so on (from Seat)