Laym
Laym2w ago

Normcore Avatar Really Big

For some reason, when running my game, and connecting to a room, my netoworked player spawns in really big, The prefab's actual scale is 0.092~, 0.092~, 0.092~ but normcore just sets it to 1, 1, 1, how do i fix this?
No description
4 Replies
kapa.ai
kapa.ai2w ago
Hi @Laym. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This issue is likely related to how the RealtimeTransform component handles scale synchronization in Normcore. Based on the information provided in the knowledge sources, I can offer some insights and potential solutions: 1. RealtimeTransform Behavior: The RealtimeTransform component is responsible for synchronizing position, rotation, and scale of objects across the network. By default, it synchronizes these properties from the owner to all other clients. 2. Ownership: As mentioned in the Networked Physics documentation, ownership plays a crucial role in how RealtimeTransform works. The owner's simulation is considered the source of truth for the object. To address your issue, try the following: 1. Request Ownership: Make sure you're requesting ownership of the avatar object when it spawns. As stated in the documentation: "if you want to move an object, you need to request ownership of it." 2. Set Initial Scale: After requesting ownership, set the initial scale of your avatar to the desired values (0.092, 0.092, 0.092) in your script. 3. Use RealtimeTransform.RequestOwnership(): You can use the RequestOwnership() method on the RealtimeTransform component to take ownership of the object. Here's a sample code snippet you could use:
using Normal.Realtime;
using UnityEngine;

public class AvatarScaleManager : MonoBehaviour
{
private RealtimeTransform realtimeTransform;

private void Start()
{
realtimeTransform = GetComponent<RealtimeTransform>();

// Request ownership of the object
realtimeTransform.RequestOwnership();

// Set the initial scale
transform.localScale = new Vector3(0.092f, 0.092f, 0.092f);
}
}
using Normal.Realtime;
using UnityEngine;

public class AvatarScaleManager : MonoBehaviour
{
private RealtimeTransform realtimeTransform;

private void Start()
{
realtimeTransform = GetComponent<RealtimeTransform>();

// Request ownership of the object
realtimeTransform.RequestOwnership();

// Set the initial scale
transform.localScale = new Vector3(0.092f, 0.092f, 0.092f);
}
}
Add this script to your avatar prefab, and it should help maintain the correct scale when spawning. If you're still experiencing issues after trying these steps, you might want to check if there are any other scripts or components affecting the scale of your avatar. Also, ensure that you're using the latest version of Normcore, as newer versions might have improvements or fixes related to scale synchronization. For more detailed information on RealtimeTransform and networked physics in Normcore, refer to the Networked Physics documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@709456664507711539> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Laym
LaymOP2w ago
turns out i had to comment out this line in the realtime script:
// Root
if (_localPlayer.root != null) {
transform.position = _localPlayer.root.position;
transform.rotation = _localPlayer.root.rotation;
//transform.localScale = _localPlayer.root.localScale; had to comment this out
}
// Root
if (_localPlayer.root != null) {
transform.position = _localPlayer.root.position;
transform.rotation = _localPlayer.root.rotation;
//transform.localScale = _localPlayer.root.localScale; had to comment this out
}
maxweisel
maxweisel2w ago
that means the game object root you’ve wired up in RealtimeAvatarManager has a scale of 1 if you fix it there it will be fixed for your avatar prefab

Did you find this page helpful?