Fixed links. |
|||
Line 2: | Line 2: | ||
# The User's real world height entered in the settings screen | # The User's real world height entered in the settings screen | ||
# Avatar Items | # Avatar Items | ||
## Any value set in [[Component:DefaultUserScale]] | ## 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 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. | ## The customized scale of the user which, depending on world configuration, can be freely changed at any time by the user. | ||
Line 19: | Line 19: | ||
* 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 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 does not take into account crouching or full-body use. | ||
* It is affected by [[Component:DefaultUserScale]] | * It is affected by [[Component:DefaultUserScale|DefaultUserScale]] | ||
== Using [[ProtoFlux:User Root Global Scale|User Root Global Scale]] == | == Using [[ProtoFlux:User Root Global Scale|User Root Global Scale]] == | ||
Line 29: | Line 29: | ||
== Using Bounding Boxes == | == Using Bounding Boxes == | ||
By using [[ProtoFlux: | 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: | 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 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 crouch and full body use. | ||
* It is affected by [[Component:DefaultUserScale]] | * It is affected by [[Component:DefaultUserScale|DefaultUserScale]] | ||
== Using Bounding Boxes with the user's character controller == | == Using Bounding Boxes with the user's character controller == | ||
If instead of using [[ProtoFlux:Compute Bounding Box]] on a user's [[ProtoFlux:User Root Slot]] you can instead use it on the Slot which their character controller is on. | 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: | 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 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. | ||
Line 48: | Line 48: | ||
* Takes into account avatar proportions. | * Takes into account avatar proportions. | ||
* Is affected by crouch and fully body use. | * Is affected by crouch and fully body use. | ||
* It is affected by [[Component: | * It is affected by [[Component:DefaultUserScale|DefaultUserScale]] | ||
=== Cancelling out [[Component:DefaultUserScale|Default User Scale]] === | === Cancelling out [[Component:DefaultUserScale|Default User Scale]] === | ||
Line 69: | Line 69: | ||
{{Note|The settings system is currently under a re-work and so this approach may break soon.|warning}} | {{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]] to access the user's height setting. | 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. | If you need to go this far, it might be easier to just ask the user to enter this value into a text field. |
Revision as of 01:14, 4 July 2024
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 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.
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 fully 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
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.