Tilt Five Unity API  1.3.0
Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
TiltFive.ScaleSettings Class Reference

ScaleSettings contains the scale data used to translate between Unity units and the user's physical space. More...

Public Member Functions

float GetScaleToUWRLD_UGBD (float gameboardScale)
 

Public Attributes

LengthUnit contentScaleUnit = LengthUnit.Centimeters
 The real-world unit to be compared against when using . More...
 
float contentScaleRatio = 5f
 The scaling ratio relates physical distances to world-space units. More...
 

Static Public Attributes

const float MIN_CONTENT_SCALE_RATIO = 0.0000001f
 

Properties

float physicalMetersPerWorldSpaceUnit [get]
 The content scale, in terms of meters per world space unit. More...
 
float worldSpaceUnitsPerPhysicalMeter [get]
 
float oneUnitLengthInMeters [get]
 

Detailed Description

ScaleSettings contains the scale data used to translate between Unity units and the user's physical space.

Definition at line 26 of file ScaleSettings.cs.

Member Function Documentation

◆ GetScaleToUWRLD_UGBD()

float TiltFive.ScaleSettings.GetScaleToUWRLD_UGBD ( float  gameboardScale)

Definition at line 73 of file ScaleSettings.cs.

74  {
75  float scaleToUGBD_UWRLD = physicalMetersPerWorldSpaceUnit * gameboardScale;
76  float scaleToUWRLD_UGBD = scaleToUGBD_UWRLD > 0
77  ? 1f / scaleToUGBD_UWRLD
78  : 1f / float.Epsilon;
79 
80  return scaleToUWRLD_UGBD;
81  }
float physicalMetersPerWorldSpaceUnit
The content scale, in terms of meters per world space unit.

References TiltFive.ScaleSettings.physicalMetersPerWorldSpaceUnit.

Referenced by TiltFive.TrackableCore< TSettings, TState >.GameboardToWorldSpace(), TiltFive.TiltFiveManager.GetScaleToUWRLD_UGBD(), TiltFive.TiltFiveManager2.GetScaleToUWRLD_UGBD(), TiltFive.Glasses.GlassesCore.Update(), and TiltFive.TrackableCore< TSettings, TState >.WorldToGameboardSpace().

Member Data Documentation

◆ contentScaleRatio

float TiltFive.ScaleSettings.contentScaleRatio = 5f

The scaling ratio relates physical distances to world-space units.

This value defines how distance units in world-space should appear to players in the real world. This is useful for initially defining a game world's sense of scale, as well as for CAD applications. Use this value alongside to choose the desired physical units (e.g. centimeters, inches, etc). Afterwards, use for cinematic or gameplay purposes.

Suppose that we want to display a bedroom scene that is 10 units across in world space. Also suppose that a person standing in this virtual bedroom would measure that distance to be 4 meters. In this case, we want 10 in-game units to represent 4 meters. Dividing 10 by 4 gives us 2.5, so contentScaleRatio should be set to 2.5 for the player to perceive the virtual space at a 1:1 ratio with reality, assuming is set to meters. If the room was now too large for a comfortable experience using the game board, we could change to inches, and the room would appear to be 25 inches across, now entirely visible within the borders of the game board.

Definition at line 50 of file ScaleSettings.cs.

◆ contentScaleUnit

LengthUnit TiltFive.ScaleSettings.contentScaleUnit = LengthUnit.Centimeters

The real-world unit to be compared against when using .

Definition at line 31 of file ScaleSettings.cs.

◆ MIN_CONTENT_SCALE_RATIO

const float TiltFive.ScaleSettings.MIN_CONTENT_SCALE_RATIO = 0.0000001f
static

Definition at line 71 of file ScaleSettings.cs.

Property Documentation

◆ oneUnitLengthInMeters

float TiltFive.ScaleSettings.oneUnitLengthInMeters
get

Definition at line 69 of file ScaleSettings.cs.

◆ physicalMetersPerWorldSpaceUnit

float TiltFive.ScaleSettings.physicalMetersPerWorldSpaceUnit
get

The content scale, in terms of meters per world space unit.

This value can be useful for gravity scaling. Simply divide Earth gravity (9.81m/s^2) by the product of this value and the game board scale.

Suppose the content scale is set to 1:10cm. Using Unity's default gravity setting, the player would see an object in freefall appear to accelerate 1/10th as fast as expected, which could feel unnatural if the game is meant to be perceived as taking place on the table in front of them in the player's space. To fix this, a script with a reference to the Tilt Five Manager could call the following on Awake():

Physics.gravity = new Vector3(0f, 9.81f / tiltFiveManager.glassesSettings.physicalMetersPerWorldSpaceUnit, 0f);

Definition at line 65 of file ScaleSettings.cs.

Referenced by TiltFive.ScaleSettings.GetScaleToUWRLD_UGBD(), and TiltFive.Glasses.GlassesCore.Update().

◆ worldSpaceUnitsPerPhysicalMeter

float TiltFive.ScaleSettings.worldSpaceUnitsPerPhysicalMeter
get

Definition at line 67 of file ScaleSettings.cs.


The documentation for this class was generated from the following file: