Best way to make player Parallel to walls?
~EDIT~
at this point, i believe that checking the player's transform.right and aligning it to the normal of the surface is the best way to do this. how should i go about doing this?
Attached is a picture that mostly demonstrates what it is im looking for for the most part, the player jumps and hits the wall an angle, the player is then rotated to be parallel with the wall.
and while ive tried setting the players rotation depending on which angle it was rotated at upon triggering the wallrun, that is extremely tedious because the player has walls to run on that are basically cylindrical (which is why the picture is mostly accurate) and the rotation of the player needs to follow the curve as it changes.
what is going to be the best way to match the players left or right side to the current normal the player is attached to?
Answer by WhipJr · Apr 24, 2017 at 02:26 PM
found it. i ended up using
if (Physics.Raycast(transform.position, -transform.right))
{
transform.rotation = Quaternion.FromToRotation(Vector3.right, hit.normal);
}
and this for the opposite side
if (Physics.Raycast(transform.position, transform.right))
{
transform.rotation = Quaternion.FromToRotation(-Vector3.right, hit.normal);
}
this only triggers upon the collision of the wall so from what i can tell, its not very taxing overall
Your answer
Follow this Question
Related Questions
Problem with rotation on a player controller 0 Answers
I use click to move, but don't want my player to rotate... How to fix this rotation? 1 Answer
Rotating an object in one axis with camera and another axis with torque 0 Answers
Character rotation, only happens when mouse is rotated around world centre (0,0,0) 0 Answers