Avindr / MxM-IssueTracking

7 stars 0 forks source link

MxMTrajectoryGeneratorBase references Time.deltaTime in UpdatePrediction #174

Closed freyzor closed 1 year ago

freyzor commented 1 year ago

This method is envoked by UpdatePastTrajectory method and can be called from Update or FixedUpdate based on AnimatorupdateMode. While I have not directly observed adverse effect this can probably cause hard to trace issues if unchecked. The simplest solution is to pass the deltaTime to UpdatePastTrajectory and have that passed down to UpdatePrediction and use that for any deltaTime sensitive code.

Avindr commented 1 year ago

Yes, this would most certainly cause some inconsistent trajectory generation with any controller that works on the physics update.

UpdatePrediction and UpdatePastTrajectory now take a float a_deltaTime instead of accessing Time.deltaTime direcly allowing it to use whatever deltaTime is appropriate based on where it is called from.