Skip to content

Commit

Permalink
Fix jumping on slopes (#581)
Browse files Browse the repository at this point in the history
This PR fixes issue #580 by checking for vertical velocity against the current ground plane rather than the players up-vector.
  • Loading branch information
Malcolmnixon authored Dec 11, 2023
1 parent e098daf commit f0679ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/godot-xr-tools/player/player_body.gd
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ func request_jump(skip_jump_velocity := false):
if !on_ground:
return

# Skip if our vertical velocity is not essentially the same as the ground
# Skip if we have any vertical velocity with regards to the ground-plane
var ground_relative := velocity - ground_velocity
if abs(ground_relative.dot(up_player)) > 0.01:
if abs(ground_relative.dot(ground_vector)) > 0.01:
return

# Skip if jump disabled on this ground
Expand Down

0 comments on commit f0679ca

Please sign in to comment.