Struct HalfVector4
Half Precision Vector4 that can also be used to convert a Quaternion to half precision.
Implements
Inherited Members
Namespace: Unity.Netcode.Components
Assembly: Unity.Netcode.Runtime.dll
Syntax
public struct HalfVector4 : INetworkSerializable
Remarks
The Vector4T<ushort> values are half float values returned by FloatToHalf(float) for each individual axis and the 16 bits of the half float are stored as ushort values since C# does not have a half float type.
Constructors
HalfVector4(float, float, float, float)
Constructor
Declaration
public HalfVector4(float x, float y, float z, float w)
Parameters
Type | Name | Description |
---|---|---|
float | x | The initial x axis (converted to half float) value when instantiated. |
float | y | The initial y axis (converted to half float) value when instantiated. |
float | z | The initial z axis (converted to half float) value when instantiated. |
float | w | The initial w axis (converted to half float) value when instantiated. |
HalfVector4(Vector4)
Constructor
Declaration
public HalfVector4(Vector4 vector4)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | vector4 | The initial axial values (converted to half floats) when instantiated. |
Fields
Axis
Used to store the half float precision values as a Unity.Mathematics.half4
Declaration
public half4 Axis
Field Value
Type | Description |
---|---|
half4 |
Properties
W
The half float precision value of the w-axis as a Unity.Mathematics.half.
Declaration
public half W { get; }
Property Value
Type | Description |
---|---|
half |
X
The half float precision value of the x-axis as a Unity.Mathematics.half.
Declaration
public half X { get; }
Property Value
Type | Description |
---|---|
half |
Y
The half float precision value of the y-axis as a Unity.Mathematics.half.
Declaration
public half Y { get; }
Property Value
Type | Description |
---|---|
half |
Z
The half float precision value of the z-axis as a Unity.Mathematics.half.
Declaration
public half Z { get; }
Property Value
Type | Description |
---|---|
half |
Methods
NetworkSerialize<T>(BufferSerializer<T>)
The serialization implementation of INetworkSerializable.
Declaration
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
BufferSerializer<T> | serializer |
Type Parameters
Name | Description |
---|---|
T |
ToQuaternion()
Converts this instance to a full precision Quaternion.
Declaration
public Quaternion ToQuaternion()
Returns
Type | Description |
---|---|
Quaternion | A Quaternion as the full precision value. |
ToVector4()
Converts this instance to a full precision Vector4.
Declaration
public Vector4 ToVector4()
Returns
Type | Description |
---|---|
Vector4 | A Vector4 as the full precision value. |
UpdateFrom(ref Quaternion)
Converts a full precision Vector4 to half precision and updates the current instance.
Declaration
public void UpdateFrom(ref Quaternion quaternion)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | quaternion | The Quaternion to convert and update this instance with. |
UpdateFrom(ref Vector4)
Converts a full precision Vector4 to half precision and updates the current instance.
Declaration
public void UpdateFrom(ref Vector4 vector4)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | vector4 | The Vector4 to convert and update this instance with. |