|
@@ -13,13 +13,13 @@ export (bool) var can_sprint = true #Alow player to toggle sprint movment.
|
|
export (float) var move_speed = 8 #Players movement speed
|
|
export (float) var move_speed = 8 #Players movement speed
|
|
export (float) var move_speed_sprint = 16 #Players sprint movement speed
|
|
export (float) var move_speed_sprint = 16 #Players sprint movement speed
|
|
export (bool) var move_sprint = false #Player sprinting toggle
|
|
export (bool) var move_sprint = false #Player sprinting toggle
|
|
-export (float) var move_acceleration = 7 #Players acceleration to movment speed
|
|
|
|
|
|
+export (float) var move_acceleration = 7 #Players acceleration to movment speed
|
|
export (float) var move_deacceleration = 10 #Players deacceleration from movment speed
|
|
export (float) var move_deacceleration = 10 #Players deacceleration from movment speed
|
|
export (bool) var mouse_captured = true #Toggles mouse captured mode
|
|
export (bool) var mouse_captured = true #Toggles mouse captured mode
|
|
export (float) var mouse_sensitivity_x = 0.3 #Mouse sensitivity X axis
|
|
export (float) var mouse_sensitivity_x = 0.3 #Mouse sensitivity X axis
|
|
export (float) var mouse_sensitivity_y = 0.3 #Mouse sensitivity Y axis
|
|
export (float) var mouse_sensitivity_y = 0.3 #Mouse sensitivity Y axis
|
|
-export (float) var mouse_max_up = 90 #Mouse max look angle up
|
|
|
|
-export (float) var mouse_max_down = -80 #Mouse max look angle down
|
|
|
|
|
|
+export (float) var mouse_max_up = 45 #Mouse max look angle up
|
|
|
|
+export (float) var mouse_max_down = -50 #Mouse max look angle down
|
|
export (float) var Jump_speed = 6 #Players jumps speed
|
|
export (float) var Jump_speed = 6 #Players jumps speed
|
|
export (bool) var allow_fall_input = true #Alow player to input movment when falling
|
|
export (bool) var allow_fall_input = true #Alow player to input movment when falling
|
|
export (bool) var stop_on_slope = false #Toggle sliding on slopes
|
|
export (bool) var stop_on_slope = false #Toggle sliding on slopes
|
|
@@ -37,7 +37,7 @@ onready var forward = global_transform.basis.y
|
|
onready var right = forward.cross(up).normalized()
|
|
onready var right = forward.cross(up).normalized()
|
|
|
|
|
|
func _ready():
|
|
func _ready():
|
|
- move_and_slide(Common.latLonToGlobal(Vector3(0,0,1750)), Vector3.UP)
|
|
|
|
|
|
+ move_and_slide(Common.latLonToGlobal(Vector3(0,0,1737.4)), Vector3.UP)
|
|
if mouse_captured:
|
|
if mouse_captured:
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
pass
|
|
pass
|
|
@@ -46,6 +46,7 @@ func _process(delta):
|
|
var pos = self.global_transform.origin
|
|
var pos = self.global_transform.origin
|
|
.get_parent().get_node("UI/1").text="x:%s y:%s z:%s" %[pos.x, pos.y, pos.z]
|
|
.get_parent().get_node("UI/1").text="x:%s y:%s z:%s" %[pos.x, pos.y, pos.z]
|
|
.get_parent().get_node("UI/2").text="latlonhight: "+str(Common.globalToLatLon(pos))+","+str(pos.length())
|
|
.get_parent().get_node("UI/2").text="latlonhight: "+str(Common.globalToLatLon(pos))+","+str(pos.length())
|
|
|
|
+ #.get_parent().get_node("UI/4").text="chunkDist: %s" % get_node("/Tiles").get_child(0).get_global_transform().origin
|
|
|
|
|
|
floor_normal = pos.normalized()
|
|
floor_normal = pos.normalized()
|
|
gravaty_vector = floor_normal * -1
|
|
gravaty_vector = floor_normal * -1
|
|
@@ -90,13 +91,13 @@ func _physics_process(delta):
|
|
# velocity += jump_vector * Jump_speed - (jump_vector * -1).normalized() * velocity.dot(jump_vector * -1)
|
|
# velocity += jump_vector * Jump_speed - (jump_vector * -1).normalized() * velocity.dot(jump_vector * -1)
|
|
|
|
|
|
#Sprint toggle
|
|
#Sprint toggle
|
|
- if can_sprint and Input.is_action_just_pressed("move_sprint") and is_on_floor():
|
|
|
|
|
|
+ if can_sprint and Input.is_action_just_pressed("move_sprint"): #and is_on_floor():
|
|
move_sprint = true
|
|
move_sprint = true
|
|
|
|
|
|
- if can_sprint and not Input.is_action_pressed("move_sprint") and is_on_floor():
|
|
|
|
|
|
+ if can_sprint and not Input.is_action_pressed("move_sprint"): #and is_on_floor():
|
|
move_sprint = false
|
|
move_sprint = false
|
|
|
|
|
|
- velocity = velocity.linear_interpolate(dir * move_speed, move_acceleration * delta)
|
|
|
|
|
|
+ velocity = velocity.linear_interpolate(dir * (move_speed_sprint if move_sprint else move_speed), move_acceleration * delta)
|
|
if !is_on_floor():
|
|
if !is_on_floor():
|
|
velocity += gravaty_vector * gravaty * delta
|
|
velocity += gravaty_vector * gravaty * delta
|
|
velocity = move_and_slide(velocity, up)
|
|
velocity = move_and_slide(velocity, up)
|