fix: camera movement
This commit is contained in:
parent
99d237af1e
commit
39939a5ce4
1 changed files with 12 additions and 8 deletions
|
|
@ -105,21 +105,25 @@ script/source = "extends SpringArm3D
|
|||
|
||||
var camera : Vector2 = Vector2()
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
func _ready():
|
||||
rotate_y(get_parent().global_rotation.y)
|
||||
|
||||
func _unhandled_input(event : InputEvent) -> void:
|
||||
if event.is_action(\"look_left\") or event.is_action(\"look_right\"):
|
||||
camera.x = Input.get_axis(\"look_right\", \"look_left\")
|
||||
elif event.is_action(\"look_up\") or event.is_action(\"look_down\"):
|
||||
camera.y = Input.get_axis(\"look_down\", \"look_up\")
|
||||
elif event is InputEventMouseMotion:
|
||||
rotate_camera((event as InputEventMouseMotion).screen_relative * -0.0015)
|
||||
rotate_camera((event as InputEventMouseMotion).screen_relative * Vector2(-0.0015, -0.0013))
|
||||
|
||||
func _physics_process(_delta : float):
|
||||
self.global_position = $\"..\".global_position + Vector3(0, 2, 0)
|
||||
|
||||
func _process(delta : float):
|
||||
rotate_camera(Vector2(camera.x * 3., camera.y * 1.) * delta)
|
||||
|
||||
func _physics_process(_delta):
|
||||
self.global_position = $\"..\".global_position + Vector3(0, 2, 0)
|
||||
|
||||
func rotate_camera(delta: Vector2):
|
||||
func rotate_camera(delta : Vector2):
|
||||
rotate_y(delta.x)
|
||||
if abs(rotation.x + delta.y) < PI/3:
|
||||
rotate_object_local(Vector3(1, 0, 0), delta.y)
|
||||
|
|
@ -181,8 +185,8 @@ input_next_margin = 0.5
|
|||
process_mode = 3
|
||||
animation_name = "swing_2"
|
||||
next_light_attack_state = NodePath("../LightAttack3")
|
||||
trigger_next_margin = 0.3
|
||||
input_next_margin = 0.6
|
||||
trigger_next_margin = 0.2
|
||||
input_next_margin = 0.4
|
||||
|
||||
[node name="LightAttack3" type="PlayerBasicAttackState" parent="."]
|
||||
process_mode = 3
|
||||
|
|
@ -192,7 +196,7 @@ input_next_margin = 0.0
|
|||
|
||||
[node name="SpringArm3D" type="SpringArm3D" parent="."]
|
||||
process_mode = 3
|
||||
transform = Transform3D(-1, 0, -8.74227e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 2, 0)
|
||||
transform = Transform3D(-1, 1.51357e-08, -8.61025e-08, 0, 0.984899, 0.173133, 8.74228e-08, 0.173133, -0.984899, 0, 2, 0)
|
||||
top_level = true
|
||||
shape = SubResource("SphereShape3D_1p07c")
|
||||
spring_length = 3.5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue