Calculate y-rot differently
This commit is contained in:
parent
fe2d586a50
commit
3e5a9b3163
@ -1066,6 +1066,7 @@ impl Player {
|
|||||||
|
|
||||||
let max_distance = (self.data.ping as f32 / 500.)
|
let max_distance = (self.data.ping as f32 / 500.)
|
||||||
* (character.dyn_bind().get_move_speed() + character.dyn_bind().get_y_speed());
|
* (character.dyn_bind().get_move_speed() + character.dyn_bind().get_y_speed());
|
||||||
|
godot_print!("{}", max_distance);
|
||||||
|
|
||||||
if client_pos.distance_to(server_pos) <= max_distance {
|
if client_pos.distance_to(server_pos) <= max_distance {
|
||||||
character.dyn_bind_mut().apply_position(client_pos);
|
character.dyn_bind_mut().apply_position(client_pos);
|
||||||
|
|||||||
@ -76,6 +76,7 @@ pub struct LocalPlayer {
|
|||||||
|
|
||||||
movement_dir: Vector3,
|
movement_dir: Vector3,
|
||||||
y_speed: f32,
|
y_speed: f32,
|
||||||
|
y_rot: f32,
|
||||||
look_up: f32,
|
look_up: f32,
|
||||||
|
|
||||||
is_dead: bool,
|
is_dead: bool,
|
||||||
@ -558,12 +559,21 @@ impl ICharacterBody3D for LocalPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let y_rot = -x * self.look_sensitivity;
|
let y_rot = -x * self.look_sensitivity;
|
||||||
self.base_mut().rotate_y(y_rot);
|
self.y_rot = self.base().get_global_rotation().y + y_rot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn physics_process(&mut self, _: f64) {
|
||||||
|
let rot = self.y_rot;
|
||||||
|
let new_rot = Vector3 {
|
||||||
|
y: rot,
|
||||||
|
..self.base().get_global_rotation()
|
||||||
|
};
|
||||||
|
self.base_mut().set_global_rotation(new_rot);
|
||||||
|
}
|
||||||
|
|
||||||
fn exit_tree(&mut self) {
|
fn exit_tree(&mut self) {
|
||||||
if let Some(game) = Game::singleton()
|
if let Some(game) = Game::singleton()
|
||||||
&& !game.bind().game_started
|
&& !game.bind().game_started
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user