-
What do you want to achieve?
Make a gui that that shows the direction of the plane shooting. (gui must be the red target circle)
If you imagine a straight line coming out of the gun muzzle, you can see that the red circle is actually only valid for a single point where it intersects that line. Or rather, the line coming out of the camera and going through the red circle only crosses at that one point. So you’ll have to make a choice about where along the line to place the red circle, and there’s no true/correct answer to that. It’s underconstrained. Is this inspired from some other game? If you link to some footage maybe I can sus out what’s going on there.
Cast a ray from plane shooting direction, make that into udim2 with a function, put a target image over it in a gui, i guess
ik just there where it hits something.
how to put it in Udim2, can you give an example?
What they said about raycasting was right, but instead of putting it into a udim2, just use the raycast result position, and use the function workspace.CurrentCamera:WorldToScreenPoint(position: Vector3)
. As you can tell you can pass the raycast result position into the function, and use the UDim2 it returns, and move a red cercle to the UDim2
(Just realized that using the raycasts wont work in the void, aka the sky that contains no parts for the raycast to hit. I would think you would have to come up with some hacky solution to get the vector3 position of where the plane is looking at. Im guessing CFrame.LookVector could help?)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.