docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct HalfVector3

    Half float precision Vector3.

    Implements
    INetworkSerializable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    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

    Fields

    Axis

    Used to store the half float precision values as a Unity.Mathematics.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 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

    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.

    Implements

    INetworkSerializable
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)