RealtimeTransform moves while not kinematic but doesn't when not kinematic
RealtimeTransform moves while not kinematic but doesn't when not kinematic
15 Replies
Hi @VRBaller. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The behavior you're experiencing is related to how RealtimeTransform works with Unity's Rigidbody component. When a Rigidbody is present, RealtimeTransform operates in Rigidbody mode and handles ownership differently.
When a Rigidbody RealtimeTransform collides with another Rigidbody RealtimeTransform, it will attempt to request ownership of the second object, so the same client can simulate both of the objects in the collision. This is done to prevent the appearance of delays during those objects’ interactions.
However, when the Rigidbody goes to sleep (i.e., it's at rest), RealtimeTransform will automatically clear ownership. This allows other clients to take over and simulate the object. If you want to avoid this behavior, you can switch the sleep option to "Maintain Ownership While Sleeping" in the Unity inspector.
When you're trying to directly move an object, it's recommended to mark it as kinematic. Doing so lets PhysX (Unity's physics engine) 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.
So, if your object is not moving when it's marked as kinematic, it might be because the ownership of the object is being cleared when it goes to sleep. You can try to maintain ownership while sleeping or ensure that you're calling
RequestOwnership()
when necessary.
For more detailed information, you can refer to the following documentation:
- RealtimeTransform (https://normcore.io/documentation/realtime/realtimetransform)
- Transform mode vs. Rigidbody mode (https://normcore.io/documentation/realtime/realtimetransform#transform-mode-vs-rigidbody-mode)
- RealtimeTransform + Physics (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--physics)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1024554162001813584> kapa.ai is still learning and improving, please let us know how it did by reacting below
@Normcore Assistant It's kinematic, realtime transform is owned. It's moving locally but it's not syncing transform position to remote clients
Let me check the knowledge base for you. One moment! :books:
----------------------
If your object is kinematic and owned by a client, but its position is not being synchronized to remote clients, there could be a few reasons for this:
1. Sync Settings: Check the sync settings of your RealtimeTransform component. Ensure that
syncPosition
is set to true. This setting determines whether the position of the game object should be synchronized. If it's set to false, the position won't be synced to remote clients. Reference (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeTransform)
2. Ownership: Make sure that the client that is moving the object is the owner of the RealtimeTransform component. If the client is not the owner, the changes it makes won't be considered the source of truth and won't be synchronized to other clients. Reference (https://normcore.io/documentation/realtime/realtimetransform#how-it-works)
3. Immediate Ownership Changes: If you're changing the ownership of the object or its position and then immediately clearing the ownership, the changes might not be sent to the server. Normcore synchronizes changes at 20hz and sends the latest state. If you change something and then change it back immediately, nothing will be sent to the server. Reference (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)
If you've checked all of these and the position is still not being synchronized, it might be worth checking for any errors or warnings in your console, as they might provide more information about what's going wrong.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1024554162001813584> kapa.ai is still learning and improving, please let us know how it did by reacting below
@kapa.ai it works when i untoggle kinematic. It only happens with kinematic toggled on
Let me check the knowledge base for you. One moment! :books:
----------------------
When a Rigidbody is marked as kinematic, it means that it's being controlled directly through its Transform, rather than being controlled by the physics engine. This is why you're able to move it locally. However, when a Rigidbody is kinematic, RealtimeTransform behaves differently.
In the case of a kinematic Rigidbody, RealtimeTransform will not clear ownership when the object goes to sleep. This is because the object is not being simulated by the physics engine, but rather is being moved directly. Therefore, if you're trying to directly move an object, you should mark it as kinematic. This 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. Reference (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--physics)
If the object's position is not being synchronized to other clients when it's kinematic, it could be because the object is not being moved in a way that RealtimeTransform recognizes. When you move a kinematic Rigidbody, make sure to do so in a way that triggers the necessary updates in RealtimeTransform.
If you're still having trouble, it might be worth reaching out to NormalVR's support with a detailed description of your issue, as they may be able to provide more specific assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@1024554162001813584> kapa.ai is still learning and improving, please let us know how it did by reacting below
I’d love a repro case for this. If it’s moving locally it should be moving remotely
do you have any other components that act on the position?
I managed to create a blank project with some weird behaviour going on related to this
It would be very helpful to know if what I'm experiencing is normal and expected
This is one of them, if you transfer ownership the object (that is not kinematic right now) to another client and that client does not move the object (does not set the object velocity) and the other one does, the object does not stop and leave the screen. Ignore the isKinematic checkbox on the left, it's not being synced.
Another thing I noted is that when the object is kinematic and moving, if you transfer ownership and forget to check if the object is yours and set the position anyway, it's overwritten and does not obey the owner of the object. Same goes to scale and rotation
ok actually it all ties down to not checking if I own the object. I was under the impression that no matter what I do, if I do not own the object, I cannot set any values...
If the relevant transforms are put in the root of the scene it fixes the problem it seems. Oddly enough cant repro in a new Project.
For Context, the
RealtimeTransforms
are usually a child of a static transform (just for less clutter in the scene hierarchy)