/VUdon-PlayerScaleUtility

Utility for receiving the relative scale of the player for calibrating e.g. IPD, pointers and quick menus

Primary LanguageC#MIT LicenseMIT

⛔ This package is deprecated! ⛔

VRChat now provides official methods and callbacks for avatar scale, use them instead:

GetAvatarEyeHeightAsMeters OnAvatarChanged OnAvatarEyeHeightChanged

VUdon - Player Scale Utility GitHub Repo stars GitHub all releases GitHub tag (latest SemVer)

Utility for receiving the relative scale of the player for calibrating e.g. IPD, pointers and quick menus

How to receive scale callbacks in UdonSharp

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.
        }
    }
}

How to constrain transform's scale to player's scale

By adding PlayerScaleConstraint to an object, its transform's scale will be locked to player's scale

image