I need to rotate a part to face the left of another part
part1.CFrame = CFrame.lookAt(part1.Position, part2.Position)
im not trying to make a part1 face part2 I’m trying to make part1 face the left(or right or back or any angle) based of part2’s look direction
In that case, you could do:
local angle = 0 -- Any angle you want in degrees
part1.CFrame = CFrame.lookAt(part1.Position, part1.Position + (part2.CFrame * CFrame.Angles(0, math.rad(angle), 0)).LookVector)
Basically what you’re doing here is keeping part1’s position the same, but for the second argument of the CFrame.lookAt, you add part1’s position by the LookVector of part2’s CFrame rotated by a certain angle. If this doesn’t rotate the part in the axis you want you could always change the arguments inside CFrame.Angles. Hope this helps.
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.