realtimetransform and rigidbody

im getting this when switching scenes, it seems to still be looking for a rigid body with a realtime transform maybe, MissingReferenceException: The object of type 'Rigidbody' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. UnityEngine.Rigidbody.get_position () (at <51ffba59437e4f058f829821d2a9db18>:0) Normal.Realtime.RealtimeTransformRigidbody.SetModelFromRigidbody (Normal.Realtime.RealtimeTransformModel model) (at <1e560f460ca04c778a16074e4afc44a9>:0) Normal.Realtime.RealtimeTransformRigidbody.OnLocalModelWillWrite (Normal.Realtime.RealtimeTransformModel model) (at <1e560f460ca04c778a16074e4afc44a9>:0) Normal.Realtime.RealtimeTransform.OnModelWillWrite (Normal.Realtime.RealtimeTransformModel model) (at <1e560f460ca04c778a16074e4afc44a9>:0) Normal.Realtime.RealtimeTransformModel.OnWillWrite () (at <1e560f460ca04c778a16074e4afc44a9>:0) Normal.Realtime.RealtimeModel.SafeInvokeCallback (Normal.Realtime.RealtimeModelEvent event) (at <1e560f460ca04c778a16074e4afc44a9>:0) UnityEngine.Debug:LogException(Exception) Normal.Realtime.RealtimeModel:SafeInvokeCallback(RealtimeModelEvent) Normal.Realtime.RealtimeModel:OnWillWrite(Room) Normal.Realtime.Room:SafeDispatchOnWillWrite() Normal.Realtime.Room:PersistenceTick(Double) Normal.Realtime.Room:RoomTick(Double) Normal.Realtime.Room:Tick(Double) Normal.Realtime.Realtime:Update()
6 Replies
kapa.ai
kapa.ai5mo ago
Hi @Lost Wizard Corp.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing is indicating that a script is trying to access a Rigidbody component that has been destroyed. This could be due to a RealtimeTransform component trying to synchronize the Rigidbody after it has been destroyed, possibly during a scene switch. RealtimeTransform works differently when a Rigidbody component is present. If RealtimeTransform detects a Rigidbody component, it synchronizes the position and rotation properties of the Rigidbody, which are in world space instead of local space. This is because PhysX simulates all rigidbodies in world space. Moving a Rigidbody via the Transform local position and rotation properties instantly teleports the Rigidbody and does not perform collision detection (source (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--physics)). If you're switching scenes and destroying objects with RealtimeTransform and Rigidbody components, you might need to ensure that the RealtimeTransform component is not trying to access the Rigidbody after it's been destroyed. You could do this by checking if the Rigidbody is null before trying to access it, or by ensuring that the RealtimeTransform component is also destroyed when the Rigidbody is destroyed. Also, remember that rigidbodies should not have parent game objects unless the parent never moves. This is because PhysX simulates all rigidbodies in world space, and synchronizing the world space position for rigidbodies can lead to unpredictable results if a Rigidbody component is synchronized, and then its parent is synchronized (source (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--rigidbody-should-not-have-parents)). If you're still having trouble, you might want to check the Normcore documentation (https://normcore.io/documentation) for more information or reach out to the Normcore support for help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
Lost Wizard Corp.
Lost Wizard Corp.OP5mo ago
@Normcore Assistant do i need to disable the rigid body object before switching scenes
kapa.ai
kapa.ai5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The Normcore documentation does not specifically mention the need to disable the Rigidbody before switching scenes. However, it's generally a good practice in Unity to clean up any resources or references that might cause issues when a scene is unloaded. If you're encountering issues with RealtimeTransform and Rigidbody during scene switches, you might want to consider disabling or destroying these components before switching scenes. This could help prevent the MissingReferenceException error you're seeing. Remember that you cannot add or remove a Rigidbody at runtime with RealtimeTransform. If you need to add or remove a Rigidbody dynamically, Normcore recommends instantiating an empty prefab with a RealtimeTransform and Rigidbody component on it, and destroying it when you're done (source (https://normcore.io/documentation/realtime/realtimetransform#extra-notes)). If you're still having trouble, you might want to check the Normcore documentation (https://normcore.io/documentation) for more information or reach out to the Normcore support for help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel5mo ago
Call disconnect and wait before switching scenes