Pantoy
Pantoy2w ago

object with rigidbody with realtime transform is sinking when local player (meta quest) sleeps

So I have 2 players in the game with rigidbodies, They are synced through realtimetransform and I set "Maintain Ownership While Sleeping". If I press off button in my quest (to sleep the device) locally, automatically, the remote equivalent with rigidbody will start to sink down. If I turn it on again, it goes back though.
16 Replies
kapa.ai
kapa.ai2w ago
Hi @Pantoy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources, this issue appears to be related to how RealtimeTransform handles physics simulation when the owning client becomes inactive. When you put your Meta Quest to sleep, your local client stops sending updates to the server. However, since you have "Maintain Ownership While Sleeping" enabled, your client retains ownership of the RealtimeTransform. This creates a situation where: 1. Your client (the owner) stops simulating and sending position updates 2. The remote client continues to simulate physics locally but cannot take ownership 3. The remote client sees the rigidbody affected by gravity without position updates from the owner According to the Networked Physics documentation, RealtimeTransform treats the owning client as the source of truth for physics simulation. When the owner stops sending updates, remote clients will continue their local simulation, which includes gravity affecting the rigidbody. Potential solutions: 1. Don't use "Maintain Ownership While Sleeping" for player objects that might go inactive. The default behavior is to clear ownership when the rigidbody goes to sleep, allowing other clients to take over simulation. 2. Make the rigidbody kinematic when the player is inactive. As noted in the Networked Physics guide, marking a rigidbody as kinematic tells PhysX you're controlling its position directly and prevents automatic physics simulation. 3. Implement disconnect detection to handle the case when a player's device goes to sleep, potentially freezing their character in place or removing them from the scene temporarily. The sinking behavior you're seeing is gravity acting on the rigidbody while no position updates are being received from the sleeping device. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@620524702938562560> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit2w ago
the sleep here refers to rigidbody.isSleeping and not headset sleep mode. when the headset goes to sleep it stops sending messages to the server and you eventually get kicked out
Pantoy
PantoyOP2w ago
i'm not kicked out though. it just make that player sinking down in its remote view. when I go back (turning quest on again) it goes back to normal position
Mechabit
Mechabit2w ago
eventually when the server times out you've got something moving the avatar downwards normcore doesn't add movement to remote avatars
Pantoy
PantoyOP2w ago
I'll investigate
maxweisel
maxweisel2w ago
if you have a script manually setting the position of the rigidbody, you need to set isKinematic to true I expect gravity is operating on this rigidbody when it’s not being reset back to the original position
Pantoy
PantoyOP2w ago
should it be for both local and remote for the kinematic? yeah its using gravity
Mechabit
Mechabit2w ago
if only the remote avatar is falling then only the remote one needs it
maxweisel
maxweisel2w ago
if you set isKinematic for local RealtimeTransform will sync it to the remote
Mechabit
Mechabit2w ago
if the headset is awake
maxweisel
maxweisel2w ago
ideally it’s set at the very beginning so when the headset goes to sleep the Rigidbody stays in place it’s not something you set only when the device goes to sleep
Mechabit
Mechabit2w ago
yeah you probably don't need non-kinematic avatars, have the physics be driven by the xrrig
Pantoy
PantoyOP2w ago
we do need non-kinematic. we need our player to fall also so we use gravity also
Mechabit
Mechabit2w ago
you can have your xr rig fall and then copy the position to the avatar. your avatar and xr rig should be separate if you're using the avatar manager it does it for you when you drag your xr rig, head and hands into the inspector
Pantoy
PantoyOP2w ago
that make sense thank you

Did you find this page helpful?