- Home /
ScreenToWorldPoint is producing inconsistent Vector3 at high X-coordinate values?
I have a method for producing projectiles in my project that uses Unity's "ScreenToWorldPoint."
This works very well when close to the (0,0,0) in world coordinates - But as I stray further from the origin only on the X-Axis, my projectiles begin to spread? Using debug techniques it seemed the Vector produced became more and more jittery and inconsistent as I move away?
On the Y-Axis I can travel to coordinates such as (0,5000,0) and the Vector3 is accurate and consistent.
I am using Cinemachine within this project, and have attempted the following solutions:
1. Switching the Render Mode for the Canvas (Since I was casting through a custom cursor)
2. Casting through the Cursor instead of my custom
3. Camera in FixedUpdate, Update, and LateUpdate for following
None of these seem to do the trick. Is it that Unity's method becomes inconsistent with high X and Y values? (2000 on the X Axis for Example). Here is the function that produces the projectiles:
Planning on cleaning up some of the ugly so please forgive!
I assume you're observing this via 2D mode in scene view to ignore potential Z-axis inconsistencies and camera parallax due to perspective? Also, 2000 is pretty high for anything other than UI elements, but it should still provide you with around 3 digits of precision after decimal point. So unless differences are measured in thousands, you should be fine with that.
Your answer
Follow this Question
Related Questions
How to keep the same position of the object instead of camera 0 Answers
How can i change a childs local position with a variable? 1 Answer
Convert type UnityEngine.Vector3' to float' Error 1 Answer
Problem with ScreenToWorldPoint and touches (C#) 2 Answers
Camera Lerp from A to B, and back 2 Answers