I’m confused as to why you’d want to do this, but could you not just use the RaycastResult value position and check vs the mouses CFrame? I feel like the bullet hit would always be the blue part though unless intercepted since you’re literally just using the mouse data to cast the ray, so arguably you could just do ray.Instance == target
I need a method to detect if the bullet isn’t going to land there, then for this UI to show them where it’s actually going to hit.
I currently have a hacky solution which is subtracting the rayposition and the mousehit position and asking if it’s distance is less than 1, but it’s not always correct.
You can just match RaycastResults.Position against the mouses Position, and if they’re not the same then just return RaycastResults.Position. I assume that you’re doing this on the client as otherwise you’d have input delay, so if you’re doing it on the server it’d be a little less successful.
You’ll have to check if the raycast actually hits anything, but for the bullet hole not being created where the bullets supposed to be, that’ll just be an issue with the actual creation of the image and it’s positioning.
I can ensure you that it’s the detection, the mouse position is correct as I used a 4 second timer before taking the screenshot to ensure the mouse position was never changed
As in using rays for hit detection? There’s a nice page on the roblox dev help page here, but you can read more about rays on youtube, experimenting, etc.
Do you see how I’m trying to shoot the wall, but the wooden post is in-front of me?! The bullet hole is where the ray actually hit.
I need a solution to get real time data on where the bullet is actually going to land, this is the best example I could provid, and I have no other idea on how to explain it