Hi,
In the follow code:
Vector3 relativePosition = myTarget.transform.position - transform.position;
When I debug and my target are very close, I don’t Know why but Unity sets the Y point negative like -0,87 and sometimes positive like 0,95. So when this happens changes everything because delta variable will grow. Can anyone help me?
Forgot to say that the test I did was with a static target, ie, it would be unable to change his position.
Anyone, plz help me! Why Unity when get position of statics gameobjects, have a little diference every time?
that’s a lot of math… what are you trying to achieve with it?
LeftyRighty,
The objective of the code is to find the two angles to hit a target. In fact it already does perfectly. However, when the target is very close he gets crazy because as point Y time is negative time gives positive he is changing the angles.
I delete the code, because I spend alot time to do that, and I will sell it. So the thing is, I get the relative position of an static object, but for some reason the Yp of the relative position time is negative and time is positive at each frame