How to modify RealtimeTransform?
I'd like to create a variant of RealtimeTransform (ideally inheriting it for compatibility) in order to meet specific needs of our game. We have fast moving platforms. When the players are on these moving platforms, their avatars appear to lag for other players, because they're synched with their world positions by RealtimeTransform in Rigidbody mode.
In the past, we've fixed this by creating our own script that synchronizes the positional offset of the player with respect to the moving platform. The avatar can then place itself with that positional offset so that they don't appear to be lagging off of the moving platform. However, this implementation isn't perfect and now I'm looking to improve it.
The ideal solution would be to inherit or copy RealtimeTransform and allow it to support relative positioning in Rigidbody mode. Is inheriting or copying the RealtimeTransform source code possible? I can see a boilerplate decomplied code in my IDE but I don't know if I trust that.
To be clear, this isn't local position synching with parents and such. As described in the docs RealtimeTransform in rigidbody mode must not be parented and uses world position.
Networked Physics | Normcore Documentation
Unless you're casually perusing the docs, you're probably here because you put a RealtimeTransform component on something and it's not working the way you expect. Well, you're in luck. This page is designed to explain how RealtimeTransform works and some of the thinking necessary to get it to do what you want.
7 Replies
Hi @beeeen. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the knowledge sources do not provide the source code for RealtimeTransform, nor do they explicitly state that you can inherit from or directly modify RealtimeTransform. The documentation does mention that RealtimeTransform is a built-in RealtimeComponent and explains its modes and limitations, including that it synchronizes world position in Rigidbody mode and does not support transform parenting for rigidbodies, which matches your understanding of the problem RealtimeTransform - Transform mode vs. Rigidbody mode.
However, there is no mention in the documentation of an officially supported way to subclass or extend RealtimeTransform, nor is there any reference to the source code being available for modification. The docs do suggest that for other built-in components like RealtimeAvatar, you can copy the source code into your own project if you want to modify it, but this is not stated for RealtimeTransform. In fact, for some components, the source is not available due to Unity's UPM package restrictions XR Avatars.
Given this, if you only see decompiled code in your IDE, it is likely that the actual source code for RealtimeTransform is not distributed with Normcore, and modifying or inheriting from it directly is not officially supported or documented.
Recommended approach:
Since direct modification or inheritance is not documented, your best option remains to implement a custom synchronization script, as you have done before, to handle relative positioning for avatars on moving platforms. You may also consider reaching out to NormalVR support or the Normcore community to request this feature or inquire about source access for advanced use cases. If you need to synchronize relative positions, you will need to continue with your custom solution, as the built-in RealtimeTransform is designed specifically for world-space synchronization in Rigidbody mode and does not support relative/offset-based synchronization out of the box. If you have further questions or need guidance on implementing your custom solution within the constraints of Normcore, feel free to ask! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Since direct modification or inheritance is not documented, your best option remains to implement a custom synchronization script, as you have done before, to handle relative positioning for avatars on moving platforms. You may also consider reaching out to NormalVR support or the Normcore community to request this feature or inquire about source access for advanced use cases. If you need to synchronize relative positions, you will need to continue with your custom solution, as the built-in RealtimeTransform is designed specifically for world-space synchronization in Rigidbody mode and does not support relative/offset-based synchronization out of the box. If you have further questions or need guidance on implementing your custom solution within the constraints of Normcore, feel free to ask! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@690217885540417680> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I'd recommend creating a from-scratch RealtimeComponent + RealtimeModel tbh
we recently shipped the timeline / interpolation features in Normcore in a way that you can use them directly in a model
if you create a
private Vector3 _position; in your RealtimeModel and add the [Interpolate] attribute. Normcore will create an interpolated getter that can do the same smoothing that RealtimeTransform does@Max, once again, your speed at responding is astounding. My hat goes off to you!
Oh my goodness - you've blown my mind! OHHHHHHH! This will be great! Thanks @Max !
Out of curiosity, is there a way to turn it on/off, just as you do in RealtimeTransform?
Gotcha, found the docs. Would you recommend having two properties that you could switch between, one interpolated and one not, if that functionality was needed?
I’d create another property for interp on/off and then just read the according property. when you use the Interpolate attribute it gives you public properties for both the interpolated and non-interpolated values