Open WilleD70 opened 3 years ago
PathCreator\Core\Editor\PathEditor.cs :
Move this code stack to OnDrag function
The above suggestion did not work. Any further news from this issue? Thanks
Any progress on this? I thought my project was haunted for a minute there.
Basically I managed to narrow it down to:
Looking into that part of the editor script mentioned above. I didn't work, but I believe that's where the problem lies.
We encounter the same problem if the object is in a parent that does not have a rotation of 0,0,0. This seems to happen only if one axis of the parent is precisely at +90 or -90 degrees.
Is it known why it moves if parent is not in rotation 0,0,0?
The reason most certainly is floating point rounding/imprecision in the InverseTransformPoint function. Why exactly it happens at+90 and -90 only I don't know, but the == operator has a built-in tolerance of 1e-005f, and at these angles, this tolerance is exceeded, which makes the point move towards the handle. But then the handle is moved as well and they are again not equal any more, causing the point to move again and so on.
What works for me is to increase the tolerance. This can be done by calculating the Distance between both vectors and compare that to a given value. However, at larger values, the difference can get bigger, again due to floating point imprecision.
What works for me is a variable tolerance that takes point position into account to make sure that when the handle is not moved by the user, the distance is always below the tolerance threshold. For this I changed the line:
if (bezierPath[i] != localHandlePosition)
into
if (Vector3.Distance(bezierPath[i], localHandlePosition) > Vector3.Magnitude(bezierPath[i]) * 1e-005f)
By using the magnitude of the point's local position (creator.transform.position + bezierPath[i]) for calculating the tolerance threshold, it will always be enough to account for the calculated distance between the point and the handle. I think with this value the threshold will always be at least about 10 times the calculated distance. Of course, this means that manipulating the handle will be somewhat less precise, but not enough to make a noticeable difference.
Hello, I have the solar system project and when I have a path in the project and I move my mouse or touch any buttons it moves on the Z axle. Any help would be great!