Struct HalfVector3
Half float precision Vector3.
Implements
Inherited Members
Namespace: Unity.Netcode.Components
Assembly: Unity.Netcode.Runtime.dll
Syntax
public struct HalfVector3 : INetworkSerializable
  Remarks
The Vector3T<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
HalfVector3(float, float, float)
Constructor that defaults to all axis being synchronized.
Declaration
public HalfVector3(float x, float y, float z)
  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.  | 
      
HalfVector3(float, float, float, bool3)
Constructor
Declaration
public HalfVector3(float x, float y, float z, bool3 axisToSynchronize)
  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.  | 
      
| 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 | The axis to synchronize.  | 
      
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 half X { get; }
  Property Value
| Type | Description | 
|---|---|
| half | 
Y
The half float precision value of the y-axis as a half.
Declaration
public half Y { get; }
  Property Value
| Type | Description | 
|---|---|
| half | 
Z
The half float precision value of the z-axis as a half.
Declaration
public half Z { get; }
  Property Value
| Type | Description | 
|---|---|
| half | 
Methods
NetworkSerialize<T>(BufferSerializer<T>)
Provides bi-directional serialization to read and write the desired data to serialize this type.
Declaration
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferSerializer<T> | serializer | The serializer to use to read and write the data.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T | Either BufferSerializerReader or BufferSerializerWriter, depending whether the serializer is in read mode or write mode.  | 
      
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.  |