GvrMathHelpers
Helper functions to perform common math operations for Gvr.
Summary
Public static functions |
|
---|---|
ConvertFloatArrayToMatrix(float[] floatArray)
|
Matrix4x4
Converts a float array of length 16 into a column-major 4x4 matrix.
|
EaseOutCubic(float min, float max, float value)
|
float
A cubic easing function (https://easings.net/#easeOutCubic).
|
GetIntersectionPosition(Camera cam, RaycastResult raycastResult)
|
Vector3
Gets the intersection position of the camera and the raycast result.
|
GvrMatrixToUnitySpace(Matrix4x4 gvrMatrix, out Vector3 position, out Quaternion orientation)
|
void
Converts matrix from Google VR convention to Unity convention.
|
NormalizedCartesianToSpherical(Vector3 cartCoords)
|
Vector2
Normalizes a 3D Cartesian direction to a 2D spherical direction.
|
Public static functions
ConvertFloatArrayToMatrix
Matrix4x4 ConvertFloatArrayToMatrix( float[] floatArray )
Converts a float array of length 16 into a column-major 4x4 matrix.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
A column-major 4x4 matrix.
|
EaseOutCubic
float EaseOutCubic( float min, float max, float value )
A cubic easing function (https://easings.net/#easeOutCubic).
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
The output of the easing function between (min) and (max).
|
GetIntersectionPosition
Vector3 GetIntersectionPosition( Camera cam, RaycastResult raycastResult )
Gets the intersection position of the camera and the raycast result.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The position of the intersection.
|
GvrMatrixToUnitySpace
void GvrMatrixToUnitySpace( Matrix4x4 gvrMatrix, out Vector3 position, out Quaternion orientation )
Converts matrix from Google VR convention to Unity convention.
Google VR is row-major, RHS coordinates, and Unity is column-major, LHS.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
NormalizedCartesianToSpherical
Vector2 NormalizedCartesianToSpherical( Vector3 cartCoords )
Normalizes a 3D Cartesian direction to a 2D spherical direction.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The spherical coordinates.
|