Hey guys, quick question–
I am trying to stick a robot’s foot to the terrain but I am having trouble laying it flat. I am using a raycast firing down into the terrain which gives me the hit.normal, the z-axis of which points upwards. I want the foot to stick to the hit point but have its y-axis pointing up along the normal. I also want the foot to rotate along its y-axis to the same angle as the robot.
So basically I’m thinking I need to do this (pseudocode):
foot.rotation = hit.normal(along z axis); // This is what I can't figure out
foot.eulerAngles.y = robot.eulerAngles.y;
I’m sure there’s a simple way to do this. Thanks for the halp! You guys own.
foot.rotation = Quaternion.LookRotation(robot.forward, hit.normal) works for the y and z rotations, but the foot does not slope 'downwards' or 'upwards', that is, the x rotation remains locked at 0.
– SergeantBiscuits