GetAvatarEyeHeightAsMeters
OnAvatarChanged
OnAvatarEyeHeightChanged
VUdon - Player Scale Utility
Utility for receiving the relative scale of the player for calibrating e.g. IPD, pointers and quick menus
By inheriting from Varneon.VUdon.PlayerScaleUtility.Abstract.PlayerScaleCallbackReceiver
you can receive callbacks from player's scale changes into your UdonSharpBehaviours:
using UdonSharp;
using UnityEngine;
using Varneon.VUdon.PlayerScaleUtility.Abstract;
namespace Varneon.VUdon.PlayerScaleUtility.Examples
{
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class PlayerScaleCallbackReceiverExample : PlayerScaleCallbackReceiver
{
// OnPlayerScaleChanged gets called when the player's avatar changes
public override void OnPlayerScaleChanged(float newPlayerScale)
{
// 'newPlayerScale' can be used to linearly scale something based on the player's scale.
// 'newPlayerScale' is at 1 when the player's avatar's height matches the player's real height.
// Player's height on desktop is ~1.73 m by default.
}
}
}
By adding PlayerScaleConstraint
to an object, its transform's scale will be locked to player's scale