SampleFPS icon indicating copy to clipboard operation
SampleFPS copied to clipboard

transform.position assign attempt for 'Player 1 (qa)' is not valid. Input position is { -Infinity, Infinity, Infinity }.

Open Preloading opened this issue 3 years ago • 7 comments

I downloaded the source code and when jumping i got...

transform.position assign attempt for 'Player 1 (qa)' is not valid. Input position is { -Infinity, Infinity, Infinity }. UnityEngine.Transform:set_position (UnityEngine.Vector3) Interpolator:InterpolatePosition (single) (at Assets/Scripts/Interpolator.cs:66) Interpolator:Update () (at Assets/Scripts/Interpolator.cs:53)

On both i opened the main scene.

Preloading avatar Jul 03 '22 00:07 Preloading

This is a known issue with the interpolation logic, but I suppose it's good that someone finally created an issue about it here :P

The errors are a result of the timeToReachTarget being set to 0, which leads to a divide by zero scenario that causes infinity, negative infinity, and/or sometimes NaN to be assigned to the position. I need to look into why exactly the timeToReachTarget calculation returns 0 sometimes, but I'm not entirely sure when I'll be able to get around to that.

In the meantime, you can avoid the errors by using Mathf.Max to force timeToReachTarget to a value greater than 0, but this is just a band-aid "fix" and not a real solution.

tom-weiland avatar Jul 03 '22 05:07 tom-weiland

Here's a fix that i found works great:

Right when we're assigning time to reach target

...
timeElpased = 0f;
float ticksToReach = (to.Tick - from.Tick);
if (ticksToReach == 0f) ticksToReach = 1f;
timeToReachTarget = ticksToReach * Time.FixedDeltaTime:

I think this also a temporary fix since i couldn't think what was going wrong in here but this will work 99% of the time i think

naveenpoddar avatar Oct 09 '22 09:10 naveenpoddar

Here's a fix that i found works great:

Right when we're assigning time to reach target

...
timeElpased = 0f;
float ticksToReach = (to.Tick - from.Tick);
if (ticksToReach == 0f) ticksToReach = 1f;
timeToReachTarget = ticksToReach * Time.FixedDeltaTime:

I think this also a temporary fix since i couldn't think what was going wrong in here but this will work 99% of the time i think

In our case setting ticksToReach = 0.001f in if statement did better job

MarcoDeevil avatar Jan 24 '23 17:01 MarcoDeevil

Doing debugging, it looks like it freaks out as a client tick update occures, for example 2753 -> 2800, which causes my case to go to 4000 speed

Preloading avatar Jul 01 '23 15:07 Preloading

More debugging, it looks to occur when the to.tick equals from.tick. how to fix it i do not know

Preloading avatar Jul 01 '23 16:07 Preloading

This decision helped me: On the client, go to the tab : Edit -> Time -> Fixed TimeStep set the same value as on the server (0.025)

Higirayn avatar Jan 20 '24 19:01 Higirayn

it tells you to make them the same I think

On Sat., Jan. 20, 2024, 12:16 p.m. Higirayn, @.***> wrote:

This decision helped me: On the client, go to the tab : Edit -> Time -> Fixed TimeStep set the same value as on the server (0.025)

— Reply to this email directly, view it on GitHub https://github.com/RiptideNetworking/SampleFPS/issues/1#issuecomment-1902243895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOPSLME44A6XZ3G2FNHJPBDYPQJXVAVCNFSM52P2IL7KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJQGIZDIMZYHE2Q . You are receiving this because you authored the thread.Message ID: @.***>

Preloading avatar Jan 20 '24 19:01 Preloading