MasterOX 水
MasterOX 水5mo ago

can a vector 3 be synced

can a vector 3 be synced in a model?
4 Replies
kapa.ai
kapa.ai5mo 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: ---------------------- Yes, a Vector3 can be synced in a model in NormalVR. According to the documentation (https://normcore.io/documentation/room/common-questions#when-i-try-to-sync-a-specific-object-to-the-datastore-i-get-an-error-that-says-it-cannot-be-serialized-whats-the-issue), only primitives such as int, float, Vector3, string, etc. can be serialized. Here is an example of a Vector3 being synced in a model:
[RealtimeModel]
public partial class MyModel {
[RealtimeProperty(4, false)] private Vector3 _movementVelocity;
}
[RealtimeModel]
public partial class MyModel {
[RealtimeProperty(4, false)] private Vector3 _movementVelocity;
}
In this example, _movementVelocity is a Vector3 that is being synced. The RealtimeProperty attribute is used to indicate that this field should be synced. The first argument to RealtimeProperty is the property's unique ID, and the second argument indicates whether the property should be reliably synced. If it's set to true, the property will always be synced reliably. If it's set to false, the property will only be synced if it changes. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
Camobiwon
Camobiwon5mo ago
Yes, any primitive along with some basic Unity types can be synced RealtimeTransform uses it for Position / Scale
MasterOX 水
MasterOX 水OP5mo ago
thank you

Did you find this page helpful?