Search Issue Tracker

Won't Fix

Votes

0

Found in

2018.4

2019.3

2019.3.4f1

2020.1

2020.2

Issue ID

1231383

Regression

No

Rigidbody2D wake-state linked to other Rigidbody2D when using experimental multi-threaded 2D physics.

Physics2D

-

How to reproduce:
1. Open tester-submitted project (sleeptest-updated.zip)
2. Open the SampleScene
3. Enter Play Mode
4. See the Console window

Expected result: body1(falling) is not sleeping, body2(stationary) is sleeping
Actual result: both RigidBody2D bodies are not sleeping

Reproducible with: 2018.4.0f1, 2018.4.20f1, 2019.3.7f1, 2020.1.0b4, 2020.2.0a5
Not reproducible with: 2017.4.39f1

Notes:
Stopping body1 by changing its Gravity Scale to 0 makes both RigidBody2D Components sleep
Reverting the Gravity Scale value for body1 only makes its RigidBody2D not sleep, body2 remains sleeping(expected result)

  1. Resolution Note (2020.2.X):

    This is an unfortunate effect of how the experimental multithreaded solver works. If you turn this setting off in the Project Settings > Physics2D you won’t get this common sleep state. A body will wake if you make certain modifications to its state but it’ll also automatically do this when the contact island its part of wakes. A contact island is a set of bodies that either directly or indirectly are solved together because they are connected via contacts. The MT solver solves a contact island on a threaded job but unfortunately some contact islands are very small and can have just a single body. Running this on a separate job would be expensive so what happens is that these contact islands get merged.

    There are strategies to solve this issue and maintain the sleep state, however, it should be noted that sleep state should be an internal performance control only. Relying on it for game behaviour can be very fragile and should be avoided. For instance, a body can wake by having one of its colliders come near another collider (if their axis-aligned bounding boxes overlap) and not necessarily by touching.

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.