The title says it all. I’m making a wall running mechanic for a third person platformer.
I’m basically trying to make it so when all the parameters are met and the “wallRun” method starts, I want the player to set it’s rotation (just the y part) parallel to the wall so it will later translate forwards and not crash into the wall.
However I do not want to simply set the objects rotation equal to the wall’s rotation. Later down the line, that won’t work for what I’m planning. I need some sort of raycast / Vector3.Cross magic.
Since the player’s rotation will vary when the “wallRun” method starts, I do not know how to raycast towards the wall. I do track if the wall is on the right or left side of the player via trigger hitboxes.
If I could raycast towards the closest point on the wall (at the same height) then raycast up, I could Vector3.Cross those and get a forwards vector parallel to the wall.
So basically, does anyone know how to raycast to the closest point on the wall? Or does someone have a better idea than what I’m thinking. (I’m sure someone does :P) Thank you in advance!
EDIT: This issue has been solved! Read the comments to see the details.