#Dynamically updating move_and_slide's up vector

3 messages · Page 1 of 1 (latest)

dawn apex
#

(specifically move_and_slide_with_snap)
I've put Vector3.UP as my player's move_and_slide_with_snap's up vector argument. However, I've made the player rotate to traverse the environment and they end up walking on walls/ceilings, which conflicts with the function's wall angle (is_on_wall returns true at these angles).

I don't know how to get the up/down vector args to update for the player's current rotation, as it seems it always treats the global Y as vertical even if I replace them with transform.basis.y which I thought would get the local Y axis.

Also I do still want the player to be stopped by steep inclines relative to their current rotation, so I don't want to just dummy out the max floor angle.

crisp merlin
#

In my own 3D sonic style project, I ended up using a raycast to get the floor normal, and using that as the up vector.

keen orbit
#

Use global_transform.basis.y, because you want your y axis in global space, not local. Although using a raycast is good too