Struct NetworkDeltaPosition
Used to synchromnize delta position when half float precision is enabled
Implements
Inherited Members
Namespace: Unity.Netcode.Components
Assembly: Unity.Netcode.Runtime.dll
Syntax
public struct NetworkDeltaPosition : INetworkSerializable
Constructors
NetworkDeltaPosition(float, float, float, int)
Constructor
Declaration
public NetworkDeltaPosition(float x, float y, float z, int networkTick)
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. |
int | networkTick | Set the network tick value to the current network tick when instantiating. |
NetworkDeltaPosition(float, float, float, int, bool3)
Constructor
Declaration
public NetworkDeltaPosition(float x, float y, float z, int networkTick, 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. |
int | networkTick | Set the network tick value to the current network tick when instantiating. |
bool3 | axisToSynchronize | The axis to be synchronized. |
NetworkDeltaPosition(Vector3, int)
Constructor that defaults to all axis being synchronized.
Declaration
public NetworkDeltaPosition(Vector3 vector3, int networkTick)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector3 | The initial axial values (converted to half floats) when instantiated. |
int | networkTick | Set the network tick value to the current network tick when instantiating. |
NetworkDeltaPosition(Vector3, int, bool3)
Constructor
Declaration
public NetworkDeltaPosition(Vector3 vector3, int networkTick, bool3 axisToSynchronize)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector3 | The initial axial values (converted to half floats) when instantiated. |
int | networkTick | Set the network tick value to the current network tick when instantiating. |
bool3 | axisToSynchronize | The axis to be synchronized. |
Fields
HalfVector3
The HalfVector3 used to synchronize the delta in position
Declaration
public HalfVector3 HalfVector3
Field Value
Type | Description |
---|---|
Half |
Methods
GetConvertedDelta()
The half float vector3 version of the current delta position.
Declaration
public Vector3 GetConvertedDelta()
Returns
Type | Description |
---|---|
Vector3 |
Remarks
Only applies to the authoritative side for Network
GetCurrentBasePosition()
Returns the current base position (excluding the delta position offset).
Declaration
public Vector3 GetCurrentBasePosition()
Returns
GetDeltaPosition()
The full precision current delta position.
Declaration
public Vector3 GetDeltaPosition()
Returns
Type | Description |
---|---|
Vector3 |
Remarks
Authoritative: Will have no precision loss Non-Authoritative: Has the current network tick's loss of precision. Precision loss adjustments are one network tick behind on the non-authoritative side.
GetFullPosition()
Returns the full position which includes the delta offset position.
Declaration
public Vector3 GetFullPosition()
Returns
NetworkSerialize<T>(BufferSerializer<T>)
The serialization implementation of INetwork
Declaration
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
Buffer |
serializer |
Type Parameters
Name | Description |
---|---|
T |
ToVector3(int)
Gets the full precision value of Vector3 position while also potentially updating the current base position.
Declaration
public Vector3 ToVector3(int networkTick)
Parameters
Type | Name | Description |
---|---|---|
int | networkTick | Use the current network tick value. |
Returns
UpdateFrom(ref Vector3, int)
Updates the position delta based off of the current base position.
Declaration
public void UpdateFrom(ref Vector3 vector3, int networkTick)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | vector3 | The full precision Vector3 value to (converted to half floats) used to determine the delta offset positon. |
int | networkTick | Set the current network tick value when updating. |