How to prevent a 3D camera from changing the player's sliding direction?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hexadotz

So here’s what im trying to do:
I made a sliding mechanic which work 80% but now there’s this problem I don’t know how to solve, you see when a player slide they go that direction and only that direction if they look another way they won’t be going there unless they toggle sliding off I’m trying to do the exact same thing
I want to know how to make it that when i slide i keep going that direction no matter where my camera looks at

can you show me Your Code?

Beatrix | 2022-07-21 14:51

Absolutely! Sorry for the late response i was on a vacation heres the code it’s from garbaj video:

If event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
     rotate_y(deg2rad(-event.relative.x * Mouse_sen))
     camera.rotate_x(deg2rad(-event.relative.y * Mouse_sen))
     camera.rotation.x = clamp(camera.rotation.x, deg2rad(-80), deg2rad(80))

All of this is in the _input function

Hexadotz | 2022-07-30 10:54