Struct HalfVector3
Inherited Members
Namespace: Unity.Netcode.Components
Syntax
public struct HalfVector3 : INetworkSerializable
Constructors
HalfVector3(Single, Single, Single)
Constructor that defaults to all axis being synchronized.
Declaration
public HalfVector3(float x, float y, float z)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The initial x axis (converted to half float) value when instantiated. |
Single | y | The initial y axis (converted to half float) value when instantiated. |
Single | z | The initial z axis (converted to half float) value when instantiated. |
HalfVector3(Single, Single, Single, bool3)
Constructor
Declaration
public HalfVector3(float x, float y, float z, bool3 axisToSynchronize)
Parameters
Type | Name | Description |
---|---|---|
Single | x | The initial x axis (converted to half float) value when instantiated. |
Single | y | The initial y axis (converted to half float) value when instantiated. |
Single | z | The initial z axis (converted to half float) value when instantiated. |
bool3 | axisToSynchronize | The axis to synchronize. |
HalfVector3(Vector3)
Constructor that defaults to all axis being synchronized.
Declaration
public HalfVector3(Vector3 vector3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector3 | The initial axial values (converted to half floats) when instantiated. |
HalfVector3(Vector3, bool3)
Constructor
Declaration
public HalfVector3(Vector3 vector3, bool3 axisToSynchronize)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector3 | The initial axial values (converted to half floats) when instantiated. |
bool3 | axisToSynchronize |
Fields
Axis
Used to store the half float precision values as a half3
Declaration
public half3 Axis
Field Value
Type | Description |
---|---|
half3 |
AxisToSynchronize
Determine which axis will be synchronized during serialization
Declaration
public bool3 AxisToSynchronize
Field Value
Type | Description |
---|---|
bool3 |
Properties
X
The half float precision value of the x-axis as a half.
Declaration
public readonly half X { get; }
Property Value
Type | Description |
---|---|
half |
Y
The half float precision value of the y-axis as a half.
Declaration
public readonly half Y { get; }
Property Value
Type | Description |
---|---|
half |
Z
The half float precision value of the z-axis as a half.
Declaration
public readonly 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 |
Implements
ToVector3()
Gets the full precision value as a Vector3.
Declaration
public Vector3 ToVector3()
Returns
Type | Description |
---|---|
Vector3 | a Vector3 as the full precision value. |
UpdateFrom(ref Vector3)
Converts a full precision Vector3 to half precision and updates the current instance.
Declaration
public void UpdateFrom(ref Vector3 vector3)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector3 | The Vector3 to convert. |