stride3d / stride3d/stride

Rigidbody option "can sleep" disables collision checking after multiple alt-tabbing in and out of window

Open
#2,032 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Release Type: Official release (Stride 4.1, downloaded from Stride homepage)

Version: Stride Game Studio 4.1.0.1948 (.NET 6.0.24)

Platform(s): I could test this bug only on Windows, did not test other platforms.

Describe the bug
The rigidbody option "Can sleep" does disable all collider checking after multiple alt-tabbing out and back into the game window. I have a very simple scene, containing an nested Entity with Rigidbody options "Can sleep" and "Is Kinematic" and a Sphere with regular Rigidbody. Also, on our cube, we have a very simple movement script that allows us to move the cube around. At the start of the game, Nested entity (with camera and a cube) and Sphere are colliding and Cube is "pushing" the Sphere (correct behavior). After a few alt-tabs back and forth, doing something else on the machine and going back into the game (alt-tabing back), from now on the sphere phases through our cube.

My guess (based on the description provided on the "Can sleep" option) would be, that the engine is still "sleeping" and not checking collisions. Or maybe, engine is not checking if the entity is moving and still sleeping.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple scene with one nested player entity (cube and camera), moving around
  2. Add Rigidbody to the nested entity (containing cube and camera) and enable "Is Kinematic" and "Can sleep" options
  3. Properly set Collider Shape
  4. Create a Sphere with a regular Rigidbody (and set the proper Collider shape)
  5. Start the game
  6. Move the cube into the Sphere (you will start pushing the Sphere, which is correct)
  7. Alt-tab out of the game multiple times (Alt-tab out, Alt-tab back, Alt-tab out, Alt-tab to different process, Alt-tab back to the game)
  8. Try repeating step number 6, instead of pushing the sphere, you will start phasing through it (no collision detected -- bug appeared)

Expected behavior
I expected the Cube to collide with the Sphere instead of phasing through.

Screenshots

Log and callstacks
If any, please attach here any log or callstack (preferably in a .txt file using GitHub drag and drop)

Additional context
No additional context comes to my mind. I was just playing around with the options, trying to make the game more and more efficient (to take less resources and maximize the FPS)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on Windows using the listed scene setup and alt-tab sequence with Can sleep enabled. Trace the rigidbody sleep and collision handling around window focus changes; done means the moving cube continues colliding with and pushing the sphere after repeated alt-tabbing.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.