Ive tried using CFrame.Lookat, and that wont work. I just want the raw numbers, i can give to specifically servos to make them look at me. I cant figure out how to get the orientation to do this.
Dont ask for code, i already deleted my old code. Im also not asking for a script, i litrally JUST want the code needed to make the 3 numbers i need. in degrees.
May I ask why CFrame.lookAt
wasn’t working for you?
It was returning a full CFrame, not just a vector3 contatng the rotation i need to make the part look at me. Also, it was giving me vlaues 0-1, not 0-180
Have you tried using :ToOrientation on the CFrame and using math.deg to convert from radians to degrees?
no how does to orientation work?
But using the CFrame from that function will make the part look at you? It sounds like you’re trying to replicate what that function does for you already.
I should specify, im not trying to make a partl ook at you directly, im trying to get the components required to drive servos to move a prt to look at you.
Ah I see. I’d recommend doing what @dthecoolest suggested then and use ToOrientation
or ToEulerAngles
and convert the values to degrees.
I dont get how i would use that to move the servos tho.
Also ive been working on code for a little, heres what i have:
task.wait(5)
while true do
local Look = CFrame.lookAt(script.Parent.Lidar.Position, game.Players:GetChildren()[1].Character.HumanoidRootPart.Position)
local rotation = Vector3.new(math.deg(Look.LookVector.X), math.deg(Look.LookVector.Y), math.deg(Look.LookVector.Z))
print(rotation)
script.Parent.Y.TargetAngle = -rotation.X
task.wait(0.05)
end
The issue with this is that it only give me rotation up to around 56 to -56 degrees
LookVector
is the vector in the direction that a part would be looking. It’s not equivalent to the rotation.
local rotY, rotX, rotZ = Look:ToOrientation()
local rotYDeg, rotXDeg, rotZDeg = math.deg(rotY), math.deg(rotX), math.deg(rotZ)
Thanks man, sorry idk a lot about CFrames
All good. They can get pretty complicated. Roblox has a nice resource if you want to learn more about them: