So I want to make a cylinder face a specific vector3 position
As you can see from the image above I want the cylinder to look at that grey part but instead it looks the other side.
I tried subtracting 90* on the XYZ but it won’t fix the issue.
I assume there is already a solution to this but I can’t seem to find it, a little help would be much appreciated please.
Cylinder.CFrame = CFrame.new(Marker.Position - (Marker.Position - Hit.Position)/2 , Marker.Position)
1 Like
Ozzypig
(Ozzypig)
November 15, 2021, 8:00pm
#2
You can multiply by CFrame.Angles(0, math.pi / 2, 0)
to rotate the resultant CFrame. Also, consider using CFrame.lookAt(position, target)
, as the CFrame.new(Vector3, Vector3)
constructor is deprecated.
2 Likes
If you want it to look at something. Use CFrame.LookAt
do this:
Cylinder.CFrame = CFrame.lookAt(Cylinder.Position, Marker.Position)
2 Likes
Thank you for the solution also it works fine. Also I never knew CFrame.new(Vector3, Vector3)
is deprecated thank you from informing me.
Thank you for the reply this one works as well but it does not fix the issue don’t worry tho @Ozzypig gave the solution.