Skip to content

Commit 9b768ae

Browse files
Add auto setup head bos in character parent class
1 parent 5642b6a commit 9b768ae

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

core/character_controller_3d.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ var _step_cycle : float = 0
155155
var _next_step : float = 0
156156

157157
## Character controller horizontal speed.
158-
var _horizontal_velocity
158+
var _horizontal_velocity : Vector3
159159

160160
## Base transform node to direct player movement
161161
## Used to differentiate fly mode/swim moves from regular character movement.

fps/fps_controller_3d.gd

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ class_name FPSController3D
3636
@export_group("Head Bob - Steps")
3737

3838
## Enables bob for made steps
39-
@export var step_bob_enabled := true
39+
@export var step_bob_enabled := true:
40+
set(value):
41+
if head_bob != null:
42+
head_bob.step_bob_enabled = value
4043

4144
## Difference of step bob movement between vertical and horizontal angle
4245
@export var vertical_horizontal_ratio = 2
@@ -45,13 +48,19 @@ class_name FPSController3D
4548
@export_group("Head Bob - Jump")
4649

4750
## Enables bob for made jumps
48-
@export var jump_bob_enabled := true
51+
@export var jump_bob_enabled := true:
52+
set(value):
53+
if head_bob != null:
54+
head_bob.jump_bob_enabled = value
4955

5056

5157
@export_group("Head Bob - Rotation When Move (Quake Like)")
5258

5359
## Enables camera angle for the direction the character controller moves
54-
@export var rotation_to_move := true
60+
@export var rotation_to_move := true:
61+
set(value):
62+
if head_bob != null:
63+
head_bob.rotation_to_move = value
5564

5665
## Speed at which the camera angle moves
5766
@export var speed_rotation := 4.0

0 commit comments

Comments
 (0)