How to make a character face a part but only with one axis?

Hello! Sorry if I did not put my question across correctly. I want the character to face a part, but instead of facing the center of the part specifically, the character faces the general direction of the part, whether it be on the x axis or the z axis (basically CFrame.lookat but restricted to 90 degree turns). How would I achieve this?

1 Like

You could constraint the look at point along a line(search up point to line equation) or constraint it along a geometric plane.

1 Like

Wouldn’t that make the player only be able to look front and back? If I phrased it wrongly, I meant that the character face a part depending on the general direction between the character and the part. I’m trying to make a wall sliding system, and I want the character to face towards the wall, not the center of the wall.

1 Like

That is much clearer with an end goal in mind.

Then you can use this vector technique. You can use cross product if you want to face parallel along the wall instead of towards.

My bad I had no idea how to put my question across lol

I don’t understand how the vector technique you gave works (The script I saw was very complicated and I’m not very good with vectors and CFrames). What is :Dot() and :Cross(), and how does the script work?