austinsb.
austinsb.4mo ago

Networking Scale

How can I scale up a 3d object within a certain time that is broadcasted to all the players. When a play joins a room the sizes are different for everyone.
Example: When I join a room the initalize size of the cube is 1. The cube starts to scale up every 5 seconds and increases by 0.05 When my friend joins the room, the cube isn't the same size that I see. They see the cube's size at its original scale of 1.
4 Replies
kapa.ai
kapa.ai4mo ago
Hi @austinsb.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To synchronize the scale of a 3D object across all players in a room, you can use the RealtimeTransform component provided by Normcore. This component can be used to synchronize the transform or rigidbody of a GameObject, including its position, rotation, and scale. Here's a step-by-step guide on how you can achieve this: 1. Add a RealtimeTransform component to the cube game object that you want to scale. 2. Make sure the "Sync Scale" toggle is checked in the RealtimeTransform component. This will ensure that the scale of the cube is synchronized across all players. 3. To scale the cube every 5 seconds, you can use a coroutine in Unity that increases the scale of the cube by 0.05 every 5 seconds. 4. When you scale the cube, you need to call RequestOwnership() on the RealtimeTransform component. This is because the RealtimeTransform component uses the concept of ownership. When an object is owned by a client, their simulation is considered the source of truth for that object. 5. Other clients can then use the ownerID property on RealtimeTransform to see who is holding it. This way, when a new player joins the room, they will see the cube at the same scale as the other players. Remember, if you want to move or scale an object, you need to request ownership of it. Here are the relevant documentation links for more information: - RealtimeTransform (https://normcore.io/documentation/realtime/realtimetransform) - Synchronizing a GameObject (https://normcore.io/documentation/realtime#synchronizing-a-gameobject) - 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) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@758033309015081090> kapa.ai is still learning and improving, please let us know how it did by reacting below
austinsb.
austinsb.4mo ago
@Normcore Assistant how can you check who ownerID?
Mechabit
Mechabit4mo ago
GetComponent<RealtimeTransform>().isOwnedLocallySelf