Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slope movement #484

Merged
merged 1 commit into from
Jul 25, 2023
Merged

Conversation

Malcolmnixon
Copy link
Collaborator

This pull request fixes issue #477 and restores normal character movement on slopes.

The CharacterBody3D will not support sliding down slopes due to gravity regardless of the options. What it will do is support sliding on a flat surface. The fix is simply to switch the CharacterBody3D 'up_direction' from the local gravity 'up' to the surface-normal of the ground. This translates the unsupported "sliding down slopes" into "sliding on a flat surface".

image

Diagram 1 - Shows how we were trying to use CharacterBody3D which does not work.

Diagram 2 - Shows how this PR changes CharacterBody3D and makes it work.

Diagram 3 - Same as the second with the observer reference frame rotated showing how the movement actually works - like pushing a piece of paper across a table.

@BastiaanOlij
Copy link
Member

I don't like it... There has to be a better way to do this. This opens up the door to walking on walls, which in itself is a nice mechanic if you want it but otherwise doesn't make sense.

Gravity is down, the slide logic in Godot is just.... ugh

Copy link
Member

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking to Malcolm, this seems like an OK workaround. My concerns are mostly addressed in the player body handling code.

@Malcolmnixon Malcolmnixon merged commit b1a9555 into GodotVR:master Jul 25, 2023
2 checks passed
@Malcolmnixon Malcolmnixon deleted the slope-movement-fix branch July 25, 2023 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants