Change X rotation on slope - Only way is Raycast?
Hello,
My objective is to change the X rotation of my character so they match the angle of any slope they will encounter. Slopes will only be 45 degrees.
I've seen many topics all about Raycasting - is there any other method that will allow me to do this?
Currently the red X happens but i'd like to get the green check mark behaviour.
Is Raycasting the only method? Or could it be done somehow with settings on my Character controller and Rigidbody?
Thank you for any tips.
Is there a particular reason you do not want to use raycasts?
Hi Chris, yes I'm using a framework since I do not know how to script. In the framework I've managed to use ray cast for simple things, just cannot figure out how to do it to change the x rotation on slopes.
I think raycasts are the way to go. This blog-post describes how to do that for feet. Basically you want to have two raycasts (on opposite sides of the object) to detect the height of the ground at those points and calculate the angle with trigonometry.
Your answer
Follow this Question
Related Questions
How to detect slope angle in 2D 1 Answer
Normal Walker Script Rotating Player Orientation Incorrectly? 0 Answers
Issue with slopes in unity 2D, can't find solution. 1 Answer
Handling Slopes 0 Answers