|
@@ -11,7 +11,7 @@ extends KinematicBody
|
|
export (bool) var can_move = true #Alow player to input movment.
|
|
export (bool) var can_move = true #Alow player to input movment.
|
|
export (bool) var can_sprint = true #Alow player to toggle sprint movment.
|
|
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 = 600#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
|
|
@@ -27,8 +27,8 @@ export (float) var max_slides = 4 #Maximum of slides
|
|
export (float) var floor_max_angle = 60 #Maximum slop angle player can traverse
|
|
export (float) var floor_max_angle = 60 #Maximum slop angle player can traverse
|
|
export (bool) var infinite_inertia = false #Toggle infinite inertia
|
|
export (bool) var infinite_inertia = false #Toggle infinite inertia
|
|
export (float) var gravaty = 1.625 #9.81 #Gravaty acceleration
|
|
export (float) var gravaty = 1.625 #9.81 #Gravaty acceleration
|
|
-export (Vector3) var gravaty_vector = Vector3(0, -1, 0) #Gravaty normal direction vector
|
|
|
|
-export (Vector3) var floor_normal = Vector3(0, 1, 0) #Floor normal direction vector
|
|
|
|
|
|
+#export (Vector3) var gravaty_vector = Vector3(0, -1, 0) #Gravaty normal direction vector
|
|
|
|
+#export (Vector3) var floor_normal = Vector3(0, 1, 0) #Floor normal direction vector
|
|
export (Vector3) var jump_vector = Vector3(0, 1, 0) #Jump normal direction vector
|
|
export (Vector3) var jump_vector = Vector3(0, 1, 0) #Jump normal direction vector
|
|
export (Vector3) var velocity = Vector3(0, 0, 0) #Initial velocity
|
|
export (Vector3) var velocity = Vector3(0, 0, 0) #Initial velocity
|
|
|
|
|
|
@@ -54,11 +54,11 @@ func getSpos():
|
|
func _process(delta):
|
|
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(getSpos())+","+str(pos.length())
|
|
#.get_parent().get_node("UI/4").text="chunkDist: %s" % get_node("/Tiles").get_child(0).get_global_transform().origin
|
|
#.get_parent().get_node("UI/4").text="chunkDist: %s" % get_node("/Tiles").get_child(0).get_global_transform().origin
|
|
|
|
|
|
- floor_normal = pos.normalized()
|
|
|
|
- gravaty_vector = floor_normal * -1
|
|
|
|
|
|
+ #floor_normal = pos.normalized()
|
|
|
|
+ #gravaty_vector = floor_normal * -1
|
|
#self.transform.basis.y = floor_normal
|
|
#self.transform.basis.y = floor_normal
|
|
#rotation_degrees.x = 90
|
|
#rotation_degrees.x = 90
|
|
|
|
|
|
@@ -108,10 +108,10 @@ func _physics_process(delta):
|
|
|
|
|
|
velocity = velocity.linear_interpolate(dir * (move_speed_sprint if move_sprint else 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 += -up * gravaty * delta
|
|
velocity = move_and_slide(velocity, up)
|
|
velocity = move_and_slide(velocity, up)
|
|
|
|
|
|
- transform = transform.looking_at(global_transform.origin + forward, up)
|
|
|
|
|
|
+ transform = transform.looking_at(transform.origin + forward, up)
|
|
|
|
|
|
|
|
|
|
#Smooth movement
|
|
#Smooth movement
|
|
@@ -137,7 +137,7 @@ func _physics_process(delta):
|
|
func _input(event):
|
|
func _input(event):
|
|
#Mouse movement
|
|
#Mouse movement
|
|
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
|
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
|
- rotate_y(deg2rad(-event.relative.x * 0.3))
|
|
|
|
|
|
+ #rotate_y(deg2rad(-event.relative.x * mouse_sensitivity_x))
|
|
forward = forward.rotated(up, deg2rad(-event.relative.x * mouse_sensitivity_x))
|
|
forward = forward.rotated(up, deg2rad(-event.relative.x * mouse_sensitivity_x))
|
|
#rotate_y(deg2rad(-event.relative.x * mouse_sensitivity_x))
|
|
#rotate_y(deg2rad(-event.relative.x * mouse_sensitivity_x))
|
|
#self.rotation_degrees.y += -event.relative.x * mouse_sensitivity_x
|
|
#self.rotation_degrees.y += -event.relative.x * mouse_sensitivity_x
|