Tilt Five Unity SDK 1.4.2
Loading...
Searching...
No Matches
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)
float GetScaleToWorldSpaceFromGameboardSpace (float gameboardScale)

Public Attributes

LengthUnit contentScaleUnit = LengthUnit.Centimeters
 The real-world unit to be compared against when using .
float contentScaleRatio = 5f
 The scaling ratio relates physical distances to world-space units.
bool legacyInvertGameboardScale = false
 Whether to enable the old, incorrect, behavior whereby the inverse of the gameboard GameObject's scale was used to calculate scaleToUWRLD_USTAGE.

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

Member Function Documentation

◆ GetScaleToUWRLD_UGBD()

float TiltFive.ScaleSettings.GetScaleToUWRLD_UGBD ( float gameboardScale)
inline

◆ GetScaleToWorldSpaceFromGameboardSpace()

float TiltFive.ScaleSettings.GetScaleToWorldSpaceFromGameboardSpace ( float gameboardScale)
inline

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.

◆ contentScaleUnit

LengthUnit TiltFive.ScaleSettings.contentScaleUnit = LengthUnit.Centimeters

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

◆ legacyInvertGameboardScale

bool TiltFive.ScaleSettings.legacyInvertGameboardScale = false

Whether to enable the old, incorrect, behavior whereby the inverse of the gameboard GameObject's scale was used to calculate scaleToUWRLD_USTAGE.

Setting this to true reverts to the legacy method for scaling the gameboard scale.

◆ MIN_CONTENT_SCALE_RATIO

const float TiltFive.ScaleSettings.MIN_CONTENT_SCALE_RATIO = 0.0000001f
static

Property Documentation

◆ oneUnitLengthInMeters

float TiltFive.ScaleSettings.oneUnitLengthInMeters
get

◆ 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);

◆ worldSpaceUnitsPerPhysicalMeter

float TiltFive.ScaleSettings.worldSpaceUnitsPerPhysicalMeter
get

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