Skip to content

Commit

Permalink
some adjustments and new parameters on CarVehicle3D
Browse files Browse the repository at this point in the history
  • Loading branch information
ninetailsrabbit committed Dec 21, 2024
1 parent d812a3f commit d8809c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions autoload/persistence/settings/input_controls.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const VehicleReverseAccelerate: StringName = &"vehicle_reverse_accelerate"
const VehicleSteerRight: StringName = &"vehicle_steer_right"
const VehicleSteerLeft: StringName = &"vehicle_steer_left"
const VehicleHandBrake: StringName = &"vehicle_hand_brake"
const StartVehicleEngine: StringName = &"start_vehicle_engine"

const PerformanceMetrics: StringName = &"performance_metrics"
const PauseGame: StringName = &"pause"
8 changes: 8 additions & 0 deletions components/motion/3D/vehicle/3D/car/car_vehicle_3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var vehicle_steer_left_action: StringName = InputControls.VehicleSteerLeft:
@export var engine_reverse_acceleration: float = 100.0
## The maximum value the wheels can be turned at
@export var max_rpm: float = 500.0
@export var start_engine_action: StringName = InputControls.StartVehicleEngine
@export_category("Steering")
## Decides how much a wheel can be turned. Higher values means that it can turn more easily
@export var kb_steering_ramp_up_factor: float = 30.0
Expand Down Expand Up @@ -68,13 +69,20 @@ var engine_on: bool = false:
stopped_engine.emit()


func _unhandled_input(_event: InputEvent) -> void:
if Input.is_action_just_pressed(start_engine_action):
engine_on = !engine_on


func _enter_tree() -> void:
add_to_group(GroupName)


func _ready() -> void:
_update_input_actions()

process_mode = PROCESS_MODE_PAUSABLE


func _physics_process(delta: float) -> void:
motion_input.update()
Expand Down
5 changes: 5 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ vehicle_steer_left={
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
]
}
start_vehicle_engine={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

[internationalization]

Expand Down

0 comments on commit d8809c9

Please sign in to comment.