look around with controller
This commit is contained in:
parent
f5e7305d01
commit
07583cd522
@ -89,20 +89,23 @@ func _process_input():
|
|||||||
if Input.is_action_pressed("move_right"):
|
if Input.is_action_pressed("move_right"):
|
||||||
input_movement_vector.x += 1
|
input_movement_vector.x += 1
|
||||||
|
|
||||||
|
# look around with controller
|
||||||
|
var look = Vector2()
|
||||||
|
look.x = -Input.get_action_strength("cam_move_left") + Input.get_action_strength("cam_move_right")
|
||||||
|
look.y = +Input.get_action_strength("cam_move_down") - Input.get_action_strength("cam_move_up")
|
||||||
|
#Logger.info("look at: " + String(look))
|
||||||
|
_camera.rotate_x(deg2rad(look.y * -1))
|
||||||
|
self.rotate_y(deg2rad(look.x * -1))
|
||||||
|
|
||||||
|
# Prevent player from doing a purzelbaum
|
||||||
|
_camera.rotation_degrees.x = clamp(_camera.rotation_degrees.x, -70, 70)
|
||||||
|
|
||||||
# look around with mouse
|
# look around with mouse
|
||||||
_dir = Vector3()
|
_dir = Vector3()
|
||||||
var camera_transform = _camera.get_global_transform()
|
var camera_transform = _camera.get_global_transform()
|
||||||
_dir += -camera_transform.basis.z * input_movement_vector.y
|
_dir += -camera_transform.basis.z * input_movement_vector.y
|
||||||
_dir += camera_transform.basis.x * input_movement_vector.x
|
_dir += camera_transform.basis.x * input_movement_vector.x
|
||||||
|
|
||||||
# look around with controller
|
|
||||||
#var look = Vector2()
|
|
||||||
#look.x = -Input.get_action_strength("cam_move_left") + Input.get_action_strength("cam_move_right")
|
|
||||||
#look.y = +Input.get_action_strength("cam_move_down") - Input.get_action_strength("cam_move_up")
|
|
||||||
##Logger.info("look at: " + String(look))
|
|
||||||
##Input.warp_mouse_position(look)
|
|
||||||
#look_at(Vector3(look.x, look.y, 1), Vector3.UP)
|
|
||||||
|
|
||||||
# jumping
|
# jumping
|
||||||
if Input.is_action_just_pressed("move_jump") and is_on_floor():
|
if Input.is_action_just_pressed("move_jump") and is_on_floor():
|
||||||
_vel.y = JUMP_SPEED
|
_vel.y = JUMP_SPEED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user