Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Preloading opened this issue Jul 3, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@Preloading
Copy link

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.

@tom-weiland tom-weiland added the bug Something isn't working label Jul 3, 2022
@tom-weiland
Copy link
Collaborator

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.

@naveenpoddar
Copy link

naveenpoddar commented Oct 9, 2022

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

@marcodeevi
Copy link

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

@Preloading
Copy link
Author

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
Copy link
Author

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

@Higirayn
Copy link

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)

@Preloading
Copy link
Author

Preloading commented Jan 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants