Skip to content

Commit

Permalink
Move camera to the top of the player's collider
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Jan 21, 2024
1 parent 4ced0e9 commit 7f1c1a4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/src/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,12 @@ impl Sim {
}

pub fn view(&self) -> Position {
self.local_character_controller.oriented_position()
let mut pos = self.local_character_controller.oriented_position();
let up = self.graph.get_relative_up(&pos).unwrap();
pos.local = common::math::translate_along(
&(up.as_ref() * -(self.cfg.character.character_radius - 1e-3)),
) * pos.local;
pos
}

/// Destroy all aspects of an entity
Expand Down

0 comments on commit 7f1c1a4

Please sign in to comment.