forked from unfa/liblast
Added simple movement prediction, smoothing out player movement.
parent
bd53962884
commit
2e4615cd1f
|
@ -82,10 +82,11 @@ var jetpack_recharge = 0.25 # how long to recharge to full
|
|||
var velocity := Vector3.ZERO
|
||||
var gravity_vec := Vector3.ZERO
|
||||
|
||||
@rpc(nosync,ordered) func update_movement(player_transform, head_rotation, jetpack):
|
||||
@rpc(nosync,unreliable) func update_movement(player_transform, head_rotation, lin_velocity, jetpack):
|
||||
global_transform = player_transform
|
||||
head.set_rotation(head_rotation)
|
||||
jetpack_active = jetpack
|
||||
linear_velocity = lin_velocity
|
||||
|
||||
func _ready() -> void:
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
@ -188,6 +189,10 @@ func _physics_process(delta):
|
|||
#rpc(&'set_global_transform', global_transform)
|
||||
#head.rpc(&'set_rotation', head.get_rotation())
|
||||
|
||||
if not is_network_authority():
|
||||
move_and_slide()
|
||||
return
|
||||
|
||||
direction = Vector3.ZERO
|
||||
|
||||
if is_on_floor() and ground_check.is_colliding() and not jetpack_active:
|
||||
|
@ -251,7 +256,7 @@ func _physics_process(delta):
|
|||
# else:
|
||||
# rpc_id(1, &'update_movement', global_transform, head.get_rotation())
|
||||
#
|
||||
rpc(&'update_movement', global_transform, head.get_rotation(), jetpack_active)
|
||||
rpc(&'update_movement', global_transform, head.get_rotation(), linear_velocity, jetpack_active)
|
||||
|
||||
# (stair) climbing
|
||||
# ↓ disabled - Tween is undergoing redesign in Godot 4
|
||||
|
|
Loading…
Reference in New Issue