User Scale: Difference between revisions

From Resonite Wiki
Create User Scale Page
 
Added type links. Added other links.
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
User scale is a thing that acts as a Multiplier to the real life height, but this is a concept that brings in a lot more complex topics than a user may think.
The scale of a user within [[Resonite]] is affected by a number of items including:
# The User's real world height entered in the settings screen
# Avatar Items
## Any value set in [[Component:DefaultUserScale|DefaultUserScale]]
## The Scale value of the slot that a user is parented to and any slots above that's scale.
## The customized scale of the user which, depending on world configuration, can be freely changed at any time by the user.


Usually using user scale is an alright solution with permissions, and works in 99% of cases, but for those who want to slip through the cracks there are more extreme methods explained in the rest of this page that will allow for more fine tuned control for puppeting systems like [[User:989onan|989onan]]'s MMD player.
These items all evaluate together to become the overall scale you see a user at within a session.


== How real life height has implications with user scale ==
As there are a number of modifiers here it can be important to know how to get the various varieties of Scale measurement available for you and what you might need to use them for. To aid with this a variety of options are presented below with each providing its various caveats etc.


How user scale first works first starts with how tall you are in real life. You may be 4 foot tall, or 8 feet tall. There are many extremes to how tall a user may be. There are also tools for steamVR and occulus that can fake this, allowing for a user to fake the size of themselves and their playspace, making them seem only 1 inch tall when they are actually massive. Resonite then takes whatever data is fed in and multiplies their size by their user scale.
== Using a [[ProtoFlux:Global Transform|Global Transform]] node on a user's root slot (with [[ProtoFlux:User Root Slot|User Root Slot]]) ==


This means when it comes to user scale, the actual size a user may be in a world setting may actually be a lot smaller or bigger than their avatar scale may first imply. They can be 1 user scale but actually be 12 feet tall, making avatar scale useless in these situations.


Now one may be inclined to use a bounding box, to get those unruly people from becoming too tall and ruining a small people's world. But there are problems with this too. A user's lasers, or a user crouching can make the notion of using a bounding box go out the window. Someone could point their laser straight up and obliterate themselves in an instant due to floating point error when you try to scale them to the right size according to bounding box size.
This value is generally what you'd use to get the size of other objects and is great for most use cases.


== The ""correct"" solution for user size ==
The main caveats in this approach are:
* It does not allow for true comparison of a user's actual height. A (1,1,1) scale user might be 6 Foot tall or they might be 2 foot tall.
* It does not take into account proportions. Avatars of different proportions may still show as the same scale values.
* It does not take into account crouching or [[Full Body Tracking|full-body]] use.
* It is affected by [[Component:DefaultUserScale|DefaultUserScale]]


Avatars can be big, small, and their bounding box doesn't mean a thing. How do we prevent users from getting through small gaps or becoming massive and destroying map intentions?
== Using [[ProtoFlux:User Root Global Scale|User Root Global Scale]] ==


This is where spine measuring comes in. It has it's caveats, but can solve the problem. First to note, an avatar's spine is very very plastic. They can be missing a chest, spine, and neck bone and still function. They can even be missing a VRIK (Which we can't really solve yet). But with what [[ProtoFlux]] tools we have, we can try to fight back. you can measure each body-node assigned bone in global space, using the distance between each one, and add them together excluding null ones to get the length of their spine. Then adding their legs you can get an extremely rough estimate on how tall they are. This can be off by 1-2 feet, but is usually foolproof for a user with VRIK. This only works if you use bones that have body node assignments, and ignoring bones in-between since those can be used to fake local transforms positions of bones and throw off your measurements.
In most cases this value will be the same as [[ProtoFlux:Global Transform|Global Transform]] only a [[Type:float|Float]] instead of a [[Type:float3|Float3]].


Once an avatar has been measured, you can scale them down to stay within a specified range, and that will stop them from going way out of range. This doesn't always work, but it's the closest we got to a foolproof system
It shares the same caveats too.
 
== Using Bounding Boxes ==
 
By using [[ProtoFlux:Compute Bounding Box|Compute Bounding Box]] on a user's [[ProtoFlux:User Root Slot|User Root Slot]], you gain access to a Bounding box that represents the player. The size of this bounding box represents the users "scale".
 
The main caveats to this approach are:
* It is affected by items on an avatar such as hats, guns, lasers and objects. This can cause the bounding box to grow and shrink unreliably.
* It is affected by crouch and [[Full Body Tracking|full body]] use.
* It is affected by [[Component:DefaultUserScale|DefaultUserScale]]
 
 
== Using Bounding Boxes with the user's character controller ==
If instead of using [[ProtoFlux:Compute Bounding Box|Compute Bounding Box]] on a user's [[ProtoFlux:User Root Slot|User Root Slot]] you can instead use it on the Slot which their character controller is on.
 
This can be done by plugging a [[ProtoFlux:Find Character Controller From User|Find Character Controller From User]] node into a [[ProtoFlux:Get Slot|Get Slot]] and then into [[ProtoFlux:Compute Bounding Box|Compute Bounding Box]].
 
This will give you a bounding box of the user's character collider. This usually results in a more accurate calculation as it is the same size that is used for collisions and walking in worlds.
 
This approach:
* Is not affected by guns, bullets, lasers or items.
* Takes into account avatar proportions.
* Is affected by crouch and [[Full Body Tracking|full body]] use.
* It is affected by [[Component:DefaultUserScale|DefaultUserScale]]
 
=== Cancelling out [[Component:DefaultUserScale|Default User Scale]] ===
It is possible to cancel out the value of the default user scale component by multiplying the size of the bounding box by 1/[[ProtoFlux:Default User Scale|Default User Scale]].
 
This will align it closer to the real height of the avatar.
 
== Manually measuring bones ==
 
For animations or really specific cases you may want to manually calculate the height.
 
This is where spine measuring comes in. It has it's caveats, but can solve the problem. First to note, an avatar's spine is very very plastic. They can be missing a chest, spine, and neck bone and still function. They can even be missing a [[Component:VRIK|VRIK]] (Which we can't really solve yet). But with what [[ProtoFlux]] tools we have, we can try to fight back. you can measure each body-node assigned bone in global space, using the distance between each one, and add them together excluding null ones to get the length of their spine. Then adding their legs you can get an extremely rough estimate on how tall they are. This can be off by 1-2 feet, but is usually foolproof for a user with VRIK. This only works if you use bones that have body node assignments, and ignoring bones in-between since those can be used to fake local transforms positions of bones and throw off your measurements.
 
Once an avatar has been measured, you can scale them down to stay within a specified range, and that will stop them from going way out of range.
 
A good example use of this is [[User:989onan|989onan]]'s MMD player.
 
== Using Settings Sync to get a User's actual height ==
 
{{Note|The settings system is currently under a re-work and so this approach may break soon.|warning}}
 
Another alternative, if you want the user's actual height is to use the [[Component:SettingsSync|SettingsSync]] to access the user's height setting.
 
If you need to go this far, it might be easier to just ask the user to enter this value into a text field.

Latest revision as of 01:24, 4 July 2024

The scale of a user within Resonite is affected by a number of items including:

  1. The User's real world height entered in the settings screen
  2. Avatar Items
    1. Any value set in DefaultUserScale
    2. The Scale value of the slot that a user is parented to and any slots above that's scale.
    3. The customized scale of the user which, depending on world configuration, can be freely changed at any time by the user.

These items all evaluate together to become the overall scale you see a user at within a session.

As there are a number of modifiers here it can be important to know how to get the various varieties of Scale measurement available for you and what you might need to use them for. To aid with this a variety of options are presented below with each providing its various caveats etc.

Using a Global Transform node on a user's root slot (with User Root Slot)

This value is generally what you'd use to get the size of other objects and is great for most use cases.

The main caveats in this approach are:

  • It does not allow for true comparison of a user's actual height. A (1,1,1) scale user might be 6 Foot tall or they might be 2 foot tall.
  • It does not take into account proportions. Avatars of different proportions may still show as the same scale values.
  • It does not take into account crouching or full-body use.
  • It is affected by DefaultUserScale

Using User Root Global Scale

In most cases this value will be the same as Global Transform only a Float instead of a Float3.

It shares the same caveats too.

Using Bounding Boxes

By using Compute Bounding Box on a user's User Root Slot, you gain access to a Bounding box that represents the player. The size of this bounding box represents the users "scale".

The main caveats to this approach are:

  • It is affected by items on an avatar such as hats, guns, lasers and objects. This can cause the bounding box to grow and shrink unreliably.
  • It is affected by crouch and full body use.
  • It is affected by DefaultUserScale


Using Bounding Boxes with the user's character controller

If instead of using Compute Bounding Box on a user's User Root Slot you can instead use it on the Slot which their character controller is on.

This can be done by plugging a Find Character Controller From User node into a Get Slot and then into Compute Bounding Box.

This will give you a bounding box of the user's character collider. This usually results in a more accurate calculation as it is the same size that is used for collisions and walking in worlds.

This approach:

  • Is not affected by guns, bullets, lasers or items.
  • Takes into account avatar proportions.
  • Is affected by crouch and full body use.
  • It is affected by DefaultUserScale

Cancelling out Default User Scale

It is possible to cancel out the value of the default user scale component by multiplying the size of the bounding box by 1/Default User Scale.

This will align it closer to the real height of the avatar.

Manually measuring bones

For animations or really specific cases you may want to manually calculate the height.

This is where spine measuring comes in. It has it's caveats, but can solve the problem. First to note, an avatar's spine is very very plastic. They can be missing a chest, spine, and neck bone and still function. They can even be missing a VRIK (Which we can't really solve yet). But with what ProtoFlux tools we have, we can try to fight back. you can measure each body-node assigned bone in global space, using the distance between each one, and add them together excluding null ones to get the length of their spine. Then adding their legs you can get an extremely rough estimate on how tall they are. This can be off by 1-2 feet, but is usually foolproof for a user with VRIK. This only works if you use bones that have body node assignments, and ignoring bones in-between since those can be used to fake local transforms positions of bones and throw off your measurements.

Once an avatar has been measured, you can scale them down to stay within a specified range, and that will stop them from going way out of range.

A good example use of this is 989onan's MMD player.

Using Settings Sync to get a User's actual height

The settings system is currently under a re-work and so this approach may break soon.

Another alternative, if you want the user's actual height is to use the SettingsSync to access the user's height setting.

If you need to go this far, it might be easier to just ask the user to enter this value into a text field.