Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2020.3

2021.1

2021.2

2021.2.0a17

Issue ID

1338794

Regression

No

Setting physical attributes of a Kinematic GameObject sometimes sets them not equal to the defined values

Physics

-

Reproduction steps:
1. Open the user's attached "DeterministicPhysicsBug2.zip" project
2. Open the "Test" scene
3. Enter the Play Mode
4. Observe the Console

Expected result: The Debug.Logs are printed infinitely
Actual result: An error is thrown after some Debug.Logs

Reproducible with: 2019.4.27f1, 2020.3.12f1, 2021.1.11f1, 2021.2.0a20
Could not test with: 2018.4.36f1 (project cannot be downgraded)

Notes:
-In the Actual results section - the error might be thrown after 10 or after 500 test
-The issue doesn't reproduce consistently

  1. Resolution Note:

    The issue was caused by using Vector3.Lerp with Time.fixedTime. During the first run, t that is passed to Lerp is less than 1 thus Lerp returns a point midway between startPosition and targetPosition. All subsequent runs had t > 1, thus Lerp returned targetPosition. Workaround: use a separate variable for time tracking and reset it every run to 0.

Comments (1)

  1. Swarley_92

    Jul 28, 2022 11:50

    also faced with this bug on 2022.1 Unity
    Can't change velocity and angular velocity for kinematic rigid body. By we already have mechanics based on previous rb behaviour. It's a really critical bug for our project

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.