So, I’m in a bit of a pinch cause I can’t seem to find a definite solution to my problem, and I don’t really have the math know-how to crack it, it seems. I’m spawning little footstep planes where the player walks, and I want to align these with the slopes of terrains. However, what I cannot for the life of me do, is keep the Y-axis, the property that makes the footsteps actually face the direction the player walked, intact.
Here’s what I’m using so far to align the mesh.
Quaternion newRot = Quaternion.FromToRotation(Vector3.up, rcHit.normal);
transform.rotation = newRot;
Any ideas how to make them keep their direction if viewed from top-down, but still align to the terrain?