JuanLouTech
JuanLouTech3mo ago

Model is "frozen" (stops updating) when owner leaves. How to avoid this?

This happens with RealtimeTransform on rigid bodies and also with custom models. It would be nice to automatically reassign ownership when user leaves to keep it controlled by someone.
5 Replies
kapa.ai
kapa.ai3mo ago
Hi @JuanLouTech. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To avoid a model from "freezing" when the owner leaves, you can use the ClearOwnership() method. This method clears the ownership of the model, allowing another client to take over by calling RequestOwnership(). For RealtimeTransform on rigid bodies, when operating in Rigidbody mode, RealtimeTransform will automatically clear ownership when the Rigidbody goes to sleep. This allows objects at rest to be automatically owned by colliding objects. If you want to avoid this behavior, you can switch the sleep option to "Maintain Ownership While Sleeping" in the inspector. For custom models, you can call ClearOwnership() when you detect that the owner is about to leave. This will clear the ownership and allow another client to take over. In addition, you can use the "Owned by Creating Client" and "Prevent Ownership Takeover" settings in the RealtimeView's advanced settings. "Owned by Creating Client" specifies whether Realtime should request ownership when the view is created. "Prevent Ownership Takeover" prevents other clients from taking over ownership of the model. You can change this setting at runtime. Remember that Normcore doesn’t send changes to the server immediately when you change ownership or the value on a model. Instead, it synchronizes at 20hz and sends the latest state. If you change something and then change it back immediately, nothing will be sent to the server. Sources: - RealtimeTransform Rigidbody mode (https://normcore.io/documentation/realtime/realtimetransform#rigidbody-mode) - RealtimeModel Methods (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeModel) - RealtimeView Ownership + Lifetime Flags (https://normcore.io/documentation/realtime/realtimeview#ownership--lifetime-flags) - Common Questions (https://normcore.io/documentation/realtime/common-questions#im-calling-requestownership-setting-the-position-of-a-transform-and-then-immediately-calling-clearownershipbut-nothing-happens-how-can-i-fix-this) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@941753147938984038> kapa.ai is still learning and improving, please let us know how it did by reacting below
JuanLouTech
JuanLouTech3mo ago
@Normcore Assistant I'm aware of the clearOwnership function as well as the other things you suggested. I was not able to make my custom model update a countdown once the owner leaves, it remains stuck at that second. Regarding rigid bodies my guess is that the problem lies in the fact that when a user has the object picked up it's isKinematic flag is set to true, so if the player holding it leaves remains kinematic and never wakes up.
maxweisel
maxweisel3mo ago
Normcore won't automatically re-assign the owner. We've got a component to do this on our list for this year though! In the meantime, the best method is to create a component that listens for ownerIDDidChange and when it's set to -1 the client with the lowest client ID takes over ownership
JuanLouTech
JuanLouTech3mo ago
Thanks @Max , this is what I'm doing right now.