MasterOX 水
MasterOX 水2mo ago

prevent ownership of child

the docs say this: "However, when a model is owned by a client, the server only lets the owning client make changes to it or to any of its child models." i need the parent to be owned but allow anyone to make changes to one of its children. how can i do that?
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In NormalVR, the ownership settings of a parent model are enforced on all child models. This means that if a parent model is owned by a client, all other clients are blocked from making changes to the model or any of its child models. This is a fundamental part of how ownership is enforced in NormalVR and cannot be changed. However, you can control the ownership of individual models using the RequestOwnership() and ClearOwnership() methods. If you want a specific child model to be modifiable by anyone, you can clear its ownership after it has been created. Here's an example:
// Get the RealtimeView component of the child model
RealtimeView childView = childObject.GetComponent<RealtimeView>();

// Clear ownership of the RealtimeView
childView.ClearOwnership();
// Get the RealtimeView component of the child model
RealtimeView childView = childObject.GetComponent<RealtimeView>();

// Clear ownership of the RealtimeView
childView.ClearOwnership();
In this example, childObject is the child model you want to be modifiable by anyone. After clearing its ownership, any client can make changes to it. Remember that this will only work if the preventOwnershipTakeover flag is not set to true on the child model. If it is, the model owner must clear ownership before another client can request it. Please note that this approach might not be suitable for all use cases, as it effectively makes the child model public and modifiable by any client. If you need more fine-grained control over who can modify the child model, you might need to implement additional logic in your application. For more information, you can refer to the Ownership section (https://normcore.io/documentation/room/ownership-and-lifetime-flags) of the NormalVR documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below