I’m trying to make a Motor6D have it’s part face a position, and I think I’m quite close, however, it does something weird which kind of just makes it look the opposite way.
Above is the video, this is the script:
local tweencframe = (CFrame.lookAt(NPC.HumanoidRootPart.Position, Position) - NPC.HumanoidRootPart.CFrame.Position) * CFrame.Angles(math.rad(90),math.rad(180),math.rad(-90)) | ||
---|---|---|
local tweencframe = tweencframe * CFrame.Angles(-math.rad(tweencframe.Rotation.X),-math.rad(tweencframe.Rotation.Y),-math.rad(tweencframe.Rotation.Z)) | ||
turncurrenttween = TS:Create(NPC.HumanoidRootPart.RootJoint,TweenInfo.new(Config.Manueverability,Enum.EasingStyle.Linear),{C1 = tweencframe}) | ||
turncurrenttween:Play() |
I’m not sure how to actually do cframe math, I’ve tried making a negative angle and adding that or something, but I’m not sure how to actually do this. I know I’ve made something similar where the rotations seem to rotate the opposite way, but I still am not very sure why this is. Thanks!
Note: It also does the inverse movements when looking up and down.