Merge branch 'master' of https://git.foxarmy.org/cs-os/cs-os
This commit is contained in:
commit
46b3100cde
|
@ -202,8 +202,16 @@ func _physics_process(delta):
|
||||||
var input_dir = Input.get_vector("left", "right", "forward", "backward")
|
var input_dir = Input.get_vector("left", "right", "forward", "backward")
|
||||||
var direction = (head.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
var direction = (head.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||||
|
|
||||||
if not is_on_floor():
|
if direction:
|
||||||
velocity.y -= 4 * gravity * delta
|
velocity.x = direction.x * speed
|
||||||
|
velocity.z = direction.z * speed
|
||||||
|
else:
|
||||||
|
if is_on_floor():
|
||||||
|
velocity.x = lerp(velocity.x, direction.x * speed * 0.5, delta * 20)
|
||||||
|
velocity.z = lerp(velocity.z, direction.z * speed * 0.5, delta * 20)
|
||||||
|
else:
|
||||||
|
velocity.x = lerp(velocity.x, direction.x * speed * 0.5, delta)
|
||||||
|
velocity.z = lerp(velocity.z, direction.z * speed * 0.5, delta)
|
||||||
if is_on_floor():
|
if is_on_floor():
|
||||||
if Input.is_action_just_pressed("jump"):
|
if Input.is_action_just_pressed("jump"):
|
||||||
velocity.y = jump
|
velocity.y = jump
|
||||||
|
@ -211,16 +219,12 @@ func _physics_process(delta):
|
||||||
speed = run
|
speed = run
|
||||||
else:
|
else:
|
||||||
speed = walk
|
speed = walk
|
||||||
if direction:
|
|
||||||
velocity.x = direction.x * speed
|
|
||||||
velocity.z = direction.z * speed
|
|
||||||
else:
|
|
||||||
velocity.x = lerp(velocity.x, direction.x * speed, delta * 4)
|
|
||||||
velocity.z = lerp(velocity.z, direction.z * speed, delta * 4)
|
|
||||||
else:
|
else:
|
||||||
|
velocity.y -= 4 * gravity * delta
|
||||||
velocity.x = lerp(velocity.x, direction.x * speed, delta)
|
velocity.x = lerp(velocity.x, direction.x * speed, delta)
|
||||||
velocity.z = lerp(velocity.z, direction.z * speed, delta)
|
velocity.z = lerp(velocity.z, direction.z * speed, delta)
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
if (!multiplayer.is_server()):
|
if (!multiplayer.is_server()):
|
||||||
if (!properties["offline_mode"]): Networking.sync_client.rpc_id(1, multiplayer.get_unique_id(), $".".position, {"y": head.rotation.y, "x": camera.rotation.x})
|
if (!properties["offline_mode"]): Networking.sync_client.rpc_id(1, multiplayer.get_unique_id(), $".".position, {"y": head.rotation.y, "x": camera.rotation.x})
|
||||||
#print("I am " + $"..".name +", belonging of " + str(multiplayer.get_unique_id()) + ", with internal ID: " + str(properties["internal_id"]))
|
#print("I am " + $"..".name +", belonging of " + str(multiplayer.get_unique_id()) + ", with internal ID: " + str(properties["internal_id"]))
|
||||||
|
|
Loading…
Reference in New Issue