Hey, so I am getting the lookvector of one part and i use the dot product on the direction between the position of both, and I get the angle using the arc cosine, but when I try actually rotating it, i dont even know it just like is being super dumb
No idea how to use :Dot or math.acos, but just changing the orientation should definitely not change the position. Try printing what the angles translation is? Maybe it has something to do with a translation every heartbeat.
Can’t you just use CFrames only look make it look at the part?
local blue, green -- fill in the variable
blue.CFrame = CFrame.new(blue.Position, green.Position)
-- use below if you need to make a different face point to green
blue.CFrame *= CFrame.Angles(0,math.rad(90),0)
What’s happening is, similar to your other question, you’re going outside the range for which acos() is defined, which results in you passing a NaN to Angles, which will send your part to the shadow realm if the resulting CFrame is used to position or even rotate the part. Try printing the angle and you will probably see “NaN” once the part disappears.
--You MUST have this check, the Unit vector of zero is NOT DEFINED
if (p2.Position - p1.Position) == Vector3.zero then
return
end
local direction = (p2.Position - p1.Position).Unit
--Rest of your code
Try removing the use of both math.deg and math.rad, because math.acos probably returns in radians. (don’t yell at me idk how acos works)
The stuttering might have something to do with how parts are dragged, so you should debug with TweenService by making the part move like that, to see how the blue part looks at it.