When using CFrame.lookAt() how do I make it so the part that is changing CFrame doesn’t tilt down looking at an object under or above
2 Likes
Don’t include the Y axis for the second argument I think
2 Likes
Yes, as dintory said, don’t include the Y axis. You can do it like so:
-- Old code
local CF = CFrame.lookAt(eye, target)
-- New code
-- The Y axis is the same with this new code, so the part will never tilt
-- and will only rotate.
local CF = CFrame.lookAt(eye, Vector3.new(target.X, eye.Y, target.Z))
1 Like
local npcToRotate = workspace:WaitForChild("Rig1").PrimaryPart
local targetNPC = workspace:WaitForChild("Rig2").PrimaryPart
targetNPC.CFrame = CFrame.new(targetNPC.Position, targetNPC.Position + npcToRotate.CFrame.LookVector)
ok, I know this works… different question here made me go testing.
I haven’t test to see if this works yet but can you please tell me if this works
ok this works but now it inverses the part. so for example I am using a question mark mesh but it reverses the question mark to make it look backwards
It shouldn’t make it look the wrong way, how are you checking which way it faces?
backward
extratext 123…
extra text again
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.