Voltaia
Voltaia2w ago

When the server owns a RealtimeTransform, is the rigidbody simulated?

When ownership is dropped my objects seem to lose their gravity.
9 Replies
kapa.ai
kapa.ai2w ago
Hi @Voltaia. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- When a RealtimeTransform component is present on a GameObject, the behavior of the object changes based on the ownership. If the RealtimeTransform component is owned locally, it synchronizes the position, rotation, scale, velocity, angular velocity, and any other settings to the datastore. If the RealtimeTransform component is not owned locally, it treats the values in the datastore as the source of truth and synchronizes them to this object. In Rigidbody mode, RealtimeTransform synchronizes the world position and rotation values in addition to all Rigidbody settings. This is because Unity's physics engine (PhysX) works entirely in world space. When a Rigidbody RealtimeTransform collides with a second Rigidbody RealtimeTransform, it will attempt to request ownership of this second object as well, so the same client can simulate both of the objects in the collision. If you're experiencing issues with objects losing their gravity when ownership is dropped, it might be due to the fact that RealtimeTransform will automatically clear ownership when the Rigidbody goes to sleep. This is done to allow other clients to take over and simulate it. If you want to avoid this behavior, you can use the inspector to switch the sleep option to "Maintain Ownership While Sleeping.” If you're trying to directly move an object, make sure to mark it kinematic. Doing so lets PhysX know that you're controlling its position and it should not simulate the object directly. It also tells RealtimeTransform that it should not clear ownership when the object goes to sleep. Sources: - RealtimeTransform + Physics (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--physics) - Ownership + Physics (https://normcore.io/documentation/realtime/networked-physics#ownership--physics) - RealtimeTransform + Rigidbody should not have parents (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--rigidbody-should-not-have-parents) - How it works (https://normcore.io/documentation/realtime/realtimetransform#how-it-works) - RealtimeTransform (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeTransform) - Transform mode vs. Rigidbody mode (https://normcore.io/documentation/realtime/realtimetransform#transform-mode-vs-rigidbody-mode) - Networked Physics (https://normcore.io/documentation/realtime/networked-physics) - How can I check who is holding an object? (https://normcore.io/documentation/room/common-questions#how-can-i-check-who-is-holding-an-object) - I’m calling RequestOwnership(), setting the position of a transform, and then immediately calling ClearOwnership()—but nothing happens. How can I fix this? (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.ai2w ago
<@276154194606424064> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel2w ago
No, they’re not simulated by the server A Unity client needs to own the RealtimeTransform in order for it to be simulated
Voltaia
Voltaia2w ago
Does this mean in order to preserve some ownership, I should drop the RealtimeView ownership, but not the RealtimeTransform ownership?
maxweisel
maxweisel2w ago
I don’t know what you mean
Voltaia
Voltaia2w ago
Right that was not put well. I'm working on VR. I need objects to be able to be passed between players. When an object is not held by a player, I want the server to own it. So, should I clear ownership on the RealtimeView, but preserve the ownership of the RealtimeTransform?
maxweisel
maxweisel2w ago
why do you want the server to own it? I’d leave the view ownership unowned the whole time. Then when someone grabs it, request ownership of the transform. If they drop it, leave it alone. RealtimeTransform will clear ownership automatically when the body comes to rest and you want the last owner to simulate it coming to rest even if they’re not holding it anymore
Voltaia
Voltaia2w ago
I've been having a lot of difficulty linking XR interaction toolkit and Normcore. I've been using OwnerIDSelfDidChange as a way to determine if someone has grabbed or dropped the object. I'm quite open to suggestions. This seems to have solved my issue for now but I understand I'm abusing the system a bit.
maxweisel
maxweisel2w ago
if you don’t want someone to be able to steal a held object, I’d request ownership of the view and transform on grab, clear ownership of just the view on release (let RT clear itself when it comes to rest) and then if you want to check if something is held, you check the view ownership