Skip to content

Commit

Permalink
Merge pull request #16 from haennes/main
Browse files Browse the repository at this point in the history
added Mousesensitivity and fixed collision of PersonCamera
  • Loading branch information
TiJayTi authored Apr 30, 2021
2 parents cfb2f5f + 5230b4e commit 8c1814e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions scenes/Player/PersonCamera.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[node name="PersonCamera" type="SpringArm"]
transform = Transform( 1, -0.000510735, 0.000318044, 0.000510832, 1, -0.000278954, -0.00031789, 0.00027913, 1, 0, 0, 0 )
collision_mask = 0
spring_length = 20.0
script = ExtResource( 1 )

Expand Down
5 changes: 3 additions & 2 deletions scripts/Player/3rdPersonCamera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extends SpringArm
enum CameraMode { FIRST_PERSON , _3RD_PERSON = 2 } # _ is needed other wise it gets confused

var scroll_speed = 0.1 #move this to CameraData
var mouse_sensitivity = Vector2(0.1,0.1)

var spring_length_last = spring_length
var current_camera_mode = CameraMode.FIRST_PERSON
Expand Down Expand Up @@ -36,8 +37,8 @@ func _input_pass_through(event : InputEventMouse):

if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
if event is InputEventMouseMotion:
rotation_degrees.x = clamp(rotation_degrees.x - event.relative.y*0.1,-90,90)
rotation_degrees.y -= event.relative.x*0.1
rotation_degrees.x = clamp(rotation_degrees.x - event.relative.y*mouse_sensitivity.y,-90,90)
rotation_degrees.y -= event.relative.x*mouse_sensitivity.x
else:
if event.is_action_pressed("scroll_in"):
spring_length -= scroll_speed
Expand Down

0 comments on commit 8c1814e

Please sign in to comment.