manglemix / Trokara

A modular package for developing terrestrial characters
MIT License
44 stars 8 forks source link

Slope management #8

Closed fire closed 3 years ago

fire commented 3 years ago

Can you explain how the slope handling works?

I remember that this was unsolved in Godot core.

manglemix commented 3 years ago

Unsolved in godot core? Could you quote that? In my opinion, the features you pointed out were not that difficult to solve

Near zero deviance on slopes means that when you walk up onto, say, a big ball, your path will barely be pushed to the side. This is done in the align_to_floor method, where the movement vector is only allowed to rotate upwards to the up vector in order to be along the floor plane.

Perfectly equal velocities on all slopes is done by rotating the linear velocity when it reaches a new floor, using the same principles above

SaracenOne commented 3 years ago

I think Fire is referring to some issues with the core Kinematic body implementation which have affected CharacterController implementations we've attempted, such as depenetration, specifically because wanted to automatic character step height, but it looks like you've implemented alternative approaches which aren't as affected by these issues.

Some of the issues with KinematicBody have been logged here though (https://github.com/godotengine/godot/issues/45333). A couple of other users have attempted to addresses these, but so far, a formal overhaul has not been approved yet.

manglemix commented 3 years ago

Oh I see. I've also been trying to add automatic step height but it's quite complicated. If my code happens to be helpful I would love to explain it in detail.