yo, i’m making a c4 system and i’m wondering if there’s any way to make a certain angle in a cframe point towards me, i know i can make a whole cframe point towards me, but i dont know if i can do it with one angle.
TLDR; I want the c4 in the video to point at me, with the Y angle.
The way that I suggest to get around that is to make it point towards your character’s current position (using CFrame.lookAt(), and just set the lookAt’s Y position to the C4’s Y position.
--Yaws a part (rotates it on its Y axis) to face towards a point in world-space.
function pointYawTowardsPoint(part, point)
local pointRelative = part.CFrame:PointToObjectSpace(point)
local yawAngleRelative = math.atan2(pointRelative.Z, pointRelative.X)
part.CFrame *= CFrame.new(0, yawAngleRelative, 0)
end
I might have flipped the coordinates or the signs of the coordinates in the atan2 call. If the model just spazzes out or has unpredictable rotation, try flipping the signs or reversing the order. Oh, and make sure the Y axis of the C4 model is actually the one that’s supposed to point “out from the surface”
well, that would ruin the surface normal, i think. I marked it as a soloution because it worked for a second untill i realised it just ruins the surface normal
Hey! i messed around with the code you sent, (huge thanks btw) and i figured you didn’t really understand what i meant.
But, on the 2nd last line i changed the CFrame.new into CFrame.Angles and that worked, thanks alot! <3