Struct Binary | Kinematica | 0.5.0-preview.1
docs.unity3d.com
    Show / Hide Table of Contents

    Struct Binary

    Memory-ready runtime asset that contains the animation library and supplementary information required by the Kinematica runtime.

    Namespace: Unity.Kinematica
    Syntax
    public struct Binary
    Remarks

    Kinematica strictly distinguishes between the editor and runtime asset. The asset builder in the Unity editor generates the runtime asset from from the editor asset. Conceptionally both representations are identical. The runtime asset contains additional acceleration structures.

    Properties

    numCodeBooks

    Returns the number of code books stored in the runtime asset.

    Declaration
    public int numCodeBooks { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.CodeBook

    numIntervals

    Returns the number of intervals stored in the runtime asset.

    Declaration
    public int numIntervals { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.Interval

    numJoints

    Returns the number of animation rig joints.

    Declaration
    public int numJoints { get; }
    Property Value
    Type Description
    Int32

    numMarkers

    Returns the number of markers stored in the runtime asset.

    Declaration
    public int numMarkers { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.Marker

    numPoses

    Returns the number of individual animation poses stored in the runtime asset.

    Declaration
    public int numPoses { get; }
    Property Value
    Type Description
    Int32

    numSegments

    Returns the number of segments stored in the runtime asset.

    Declaration
    public int numSegments { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.Segment

    numTagLists

    Returns the number of tag lists stored in the runtime asset.

    Declaration
    public int numTagLists { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.TagList

    numTags

    Returns the number of tags stored in the runtime asset.

    Declaration
    public int numTags { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.Tag

    numTraits

    Returns the number of traits stored in the runtime asset.

    Declaration
    public int numTraits { get; }
    Property Value
    Type Description
    Int32
    See Also
    Binary.Trait

    SampleRate

    Returns the sample rate as number of samples per second.

    Declaration
    public float SampleRate { get; }
    Property Value
    Type Description
    Single

    TimeHorizon

    Time horizon in seconds.

    Declaration
    public float TimeHorizon { get; }
    Property Value
    Type Description
    Single
    Remarks

    The time horizon is a glocal setting that is used for trajectory matching.

    See Also
    Binary.TrajectoryFragment

    Methods

    Advance(SamplingTime, Single)

    Advances a sampling time by a certain amount of time.

    Declaration
    public DeltaSamplingTime Advance(SamplingTime samplingTime, float deltaTime)
    Parameters
    Type Name Description
    SamplingTime samplingTime

    The reference time to advance from.

    Single deltaTime

    The time increment to advance by in seconds.

    Returns
    Type Description
    DeltaSamplingTime

    The resulting sampling time.

    Remarks

    This method advances a starting time by a certain amount of time.

    It is valid to pass a negative delta time in order to step backward in time.

    The resulting time can belong to a different segment if boundary clips have been configured for the segment that the initial time belongs to.

    The resulting new sampling time will be clamped at segment boundaries if no boundary clips have been defined for the segment that the initial time belongs to.

    Contains(ref Binary.TagList, Binary.TraitIndex)

    Checks if a given trait belongs to a given trait list.

    Declaration
    public bool Contains(ref Binary.TagList tagList, Binary.TraitIndex traitIndex)
    Parameters
    Type Name Description
    Binary.TagList tagList

    The tag list to check against.

    Binary.TraitIndex traitIndex

    The trait to check for.

    Returns
    Type Description
    Boolean

    True if the given trait belongs to the trait list, false otherwise.

    Contains(Binary.TagListIndex, Binary.TraitIndex)

    Checks if a given trait belongs to a given trait list.

    Declaration
    public bool Contains(Binary.TagListIndex tagListIndex, Binary.TraitIndex traitIndex)
    Parameters
    Type Name Description
    Binary.TagListIndex tagListIndex

    The tag list to check against.

    Binary.TraitIndex traitIndex

    The trait to check for.

    Returns
    Type Description
    Boolean

    True if the given trait belongs to the trait list, false otherwise.

    CreatePoseFragment(Binary.MetricIndex, SamplingTime)

    Create a pose fragment from a sampling time.

    Declaration
    public Binary.PoseFragment CreatePoseFragment(Binary.MetricIndex metricIndex, SamplingTime samplingTime)
    Parameters
    Type Name Description
    Binary.MetricIndex metricIndex

    The metric defining the pose fragment layout.

    SamplingTime samplingTime

    The sampling time that the pose fragment should be created for.

    Returns
    Type Description
    Binary.PoseFragment

    The resulting pose fragment.

    CreateTrajectoryFragment(Binary.MetricIndex, MemoryArray<AffineTransform>)

    Creates a trajectory fragment from sequence of root transforms.

    Declaration
    public Binary.TrajectoryFragment CreateTrajectoryFragment(Binary.MetricIndex metricIndex, MemoryArray<AffineTransform> trajectory)
    Parameters
    Type Name Description
    Binary.MetricIndex metricIndex

    The metric defining the trajectory fragment layout.

    MemoryArray<AffineTransform> trajectory

    Sequence of root transforms in character space.

    Returns
    Type Description
    Binary.TrajectoryFragment

    The resulting trajectory fragment.

    Remarks

    The root transforms passed as argument are expected to be relative to the world origin, i.e. in character space.

    CreateTrajectoryFragment(Binary.MetricIndex, SamplingTime)

    Creates a trajectory fragment from a sampling time.

    Declaration
    public Binary.TrajectoryFragment CreateTrajectoryFragment(Binary.MetricIndex metricIndex, SamplingTime samplingTime)
    Parameters
    Type Name Description
    Binary.MetricIndex metricIndex

    The metric defining the trajectory fragment layout.

    SamplingTime samplingTime

    The sampling time that the trajectory fragment should be created for.

    Returns
    Type Description
    Binary.TrajectoryFragment

    The resulting trajectory fragment.

    DebugDrawPoseWorldSpace(AffineTransform, Single, Color)

    Debug visualization for animation poses.

    Declaration
    public void DebugDrawPoseWorldSpace(AffineTransform rootTransform, float sampleTimeInSeconds, Color color)
    Parameters
    Type Name Description
    AffineTransform rootTransform

    A world space transform that determines the position and orientation of the animation pose.

    Single sampleTimeInSeconds

    A time in seconds that determines the animation pose.

    Color color

    The color that the pose should be drawn with.

    DebugDrawPoseWorldSpace(AffineTransform, SamplingTime, Color)

    Debug visualization for animation poses.

    Declaration
    public void DebugDrawPoseWorldSpace(AffineTransform rootTransform, SamplingTime samplingTime, Color color)
    Parameters
    Type Name Description
    AffineTransform rootTransform

    A world space transform that determines the position and orientation of the animation pose.

    SamplingTime samplingTime

    A sampling time that determines the animation pose.

    Color color

    The color that the pose should be drawn with.

    DebugDrawTrajectory(AffineTransform, Int32, Int32, Color)

    Debug visualization for trajectories.

    Declaration
    public void DebugDrawTrajectory(AffineTransform referenceTransform, int poseIndex, int numFrames, Color color)
    Parameters
    Type Name Description
    AffineTransform referenceTransform

    A world space transform that determines the anchor that is to be used for the trajectory visualization.

    Int32 poseIndex

    A pose index that determines where the trajectory should start.

    Int32 numFrames

    A duration in frames that determines the length of the trajectory.

    Color color

    The color that the trajectory should be drawn with.

    DebugDrawTrajectory(AffineTransform, Single, Single, Color)

    Debug visualization for trajectories.

    Declaration
    public AffineTransform DebugDrawTrajectory(AffineTransform referenceTransform, float sampleTimeInSeconds, float duration, Color color)
    Parameters
    Type Name Description
    AffineTransform referenceTransform

    A world space transform that determines the anchor that is to be used for the trajectory visualization.

    Single sampleTimeInSeconds

    A time in seconds that determines where the trajectory should start.

    Single duration

    A duration in seconds that determines the length of the trajectory.

    Color color

    The color that the trajectory should be drawn with.

    Returns
    Type Description
    AffineTransform

    DebugDrawTrajectory(AffineTransform, SamplingTime, Single, Color)

    Debug visualization for trajectories.

    Declaration
    public void DebugDrawTrajectory(AffineTransform anchorTransform, SamplingTime samplingTime, float timeHorizon, Color color)
    Parameters
    Type Name Description
    AffineTransform anchorTransform

    A world space transform that determines the anchor that is to be used for the trajectory visualization.

    SamplingTime samplingTime

    A sampling time that determines where the trajectory should start.

    Single timeHorizon

    A duration in seconds that determines the length of the trajectory.

    Color color

    The color that the trajectory should be drawn with.

    DebugDrawTransform(AffineTransform, Single, Single)

    Debug visualization for transforms, i.e. a position and rotation.

    Declaration
    public static void DebugDrawTransform(AffineTransform transform, float scale, float alpha = 1F)
    Parameters
    Type Name Description
    AffineTransform transform

    The transforms that should be displayed.

    Single scale

    A scale that determines the length of the rotation axis of the transform.

    Single alpha

    An color alpha value that is to be used for the rotation axis display.

    GetCodeBook(Binary.CodeBookIndex)

    Retrieves a reference to a codebook stored in the runtime asset.

    Declaration
    public Binary.CodeBook GetCodeBook(Binary.CodeBookIndex index)
    Parameters
    Type Name Description
    Binary.CodeBookIndex index

    The codebook index to retrieve the reference for.

    Returns
    Type Description
    Binary.CodeBook

    Codebook reference that corresponds to the index passed as argument.

    GetCodeBookAt(TimeIndex)

    Returns a codebook index for a time index.

    Declaration
    public Binary.CodeBookIndex GetCodeBookAt(TimeIndex timeIndex)
    Parameters
    Type Name Description
    TimeIndex timeIndex

    The time index for which the codebook index should be retrieved.

    Returns
    Type Description
    Binary.CodeBookIndex

    Codebook index that corresponds to the time index passed as argument.

    Remarks

    Tags define whether or not pose and trajectory fragments should be created for the animation frames they span. Given a time index this method performs a lookup to determine which codebook this time belongs to. This in turn gives access to the fragments that correspond to the time index.

    GetInterval(Binary.IntervalIndex)

    Retrieves a reference to an interval stored in the runtime asset.

    Declaration
    public Binary.Interval GetInterval(Binary.IntervalIndex intervalIndex)
    Parameters
    Type Name Description
    Binary.IntervalIndex intervalIndex

    The interval index to retrieve the reference for.

    Returns
    Type Description
    Binary.Interval

    Interval reference that corresponds to the index passed as argument.

    GetMarker(Binary.MarkerIndex)

    Retrieves a reference to a marker stored in the runtime asset.

    Declaration
    public Binary.Marker GetMarker(Binary.MarkerIndex index)
    Parameters
    Type Name Description
    Binary.MarkerIndex index

    The marker index to retrieve the reference for.

    Returns
    Type Description
    Binary.Marker

    Marker reference that corresponds to the index passed as argument.

    GetPayload<T>(Int32)

    Retrieves a reference to a payload stored in the runtime asset.

    Declaration
    public T GetPayload<T>(int payload)
        where T : struct
    Parameters
    Type Name Description
    Int32 payload

    Identifies the payload that should be retrieved.

    Returns
    Type Description
    T

    Reference to the payload that corresponds to the index passed as argument.

    Type Parameters
    Name Description
    T

    GetPayload<T>(Binary.TraitIndex)

    Retrieves the associated payload (i.e. the instance of the user-defined value) for a given trait index.

    Declaration
    public T GetPayload<T>(Binary.TraitIndex traitIndex)
        where T : struct
    Parameters
    Type Name Description
    Binary.TraitIndex traitIndex

    The trait index for which the corresponding payload is to be retrieved.

    Returns
    Type Description
    T

    Reference to the user-defined value that corresponds to the trait index passed as argument.

    Type Parameters
    Name Description
    T

    GetSegment(Binary.SegmentIndex)

    Retrieves a reference to a segment stored in the runtime asset.

    Declaration
    public Binary.Segment GetSegment(Binary.SegmentIndex index)
    Parameters
    Type Name Description
    Binary.SegmentIndex index

    The segment index to retrieve the reference for.

    Returns
    Type Description
    Binary.Segment

    Segment reference that corresponds to the index passed as argument.

    GetString(Int32)

    Retrieves a string that corresponds to the index passed as argument.

    Declaration
    public string GetString(int index)
    Parameters
    Type Name Description
    Int32 index

    Index that identifies the string to be retrieved.

    Returns
    Type Description
    String

    A string that corresponds to the contents identified by the index passed as argument.

    GetTag(Binary.TagIndex)

    Retrieves a reference to a tag stored in the runtime asset.

    Declaration
    public Binary.Tag GetTag(Binary.TagIndex tagIndex)
    Parameters
    Type Name Description
    Binary.TagIndex tagIndex

    The tag index to retrieve the reference for.

    Returns
    Type Description
    Binary.Tag

    Tag reference that corresponds to the index passed as argument.

    GetTagList(Binary.TagListIndex)

    Retrieves a tag list given a tag list index from the runtime asset.

    Declaration
    public Binary.TagList GetTagList(Binary.TagListIndex tagListIndex)
    Parameters
    Type Name Description
    Binary.TagListIndex tagListIndex

    The tag list index.

    Returns
    Type Description
    Binary.TagList

    Reference to the corresponding tag list for the index passed as argument.

    GetTrait(Binary.TraitIndex)

    Retrieves a reference to a trait stored in the runtime asset.

    Declaration
    public Binary.Trait GetTrait(Binary.TraitIndex traitIndex)
    Parameters
    Type Name Description
    Binary.TraitIndex traitIndex

    The trait index to retrieve the reference for.

    Returns
    Type Description
    Binary.Trait

    Trait reference that corresponds to the index passed as argument.

    GetTraitIndex<T>(T)

    Converts a value to a trait index.

    Declaration
    public Binary.TraitIndex GetTraitIndex<T>(T value)
        where T : struct
    Parameters
    Type Name Description
    T value

    The value to be converted to a trait index.

    Returns
    Type Description
    Binary.TraitIndex

    The trait index that corresponds to the value passed as argument.

    Type Parameters
    Name Description
    T
    Remarks
    var traitIndex =
        binary.GetTraitIndex(
            Climbing.Create(Climbing.Type.Wall));

    GetTrajectoryTransform(Int32)

    Retrieves the root transform for an animation frame.

    Declaration
    public AffineTransform GetTrajectoryTransform(int poseIndex)
    Parameters
    Type Name Description
    Int32 poseIndex

    The pose index for which the root transform is to be retrieved.

    Returns
    Type Description
    AffineTransform

    The root transform that corresponds to the pose index passed as argument.

    GetTrajectoryTransform(Single)

    Retrieves the root transform for a sample time in seconds.

    Declaration
    public AffineTransform GetTrajectoryTransform(float sampleTimeInSeconds)
    Parameters
    Type Name Description
    Single sampleTimeInSeconds

    The sample time in seconds for which the root transform is to be retrieved.

    Returns
    Type Description
    AffineTransform

    The root transform that corresponds to the sample time passed as argument.

    GetTrajectoryTransform(DeltaSamplingTime)

    Retrieves the root transform displacement for a delta sampling time.

    Declaration
    public AffineTransform GetTrajectoryTransform(DeltaSamplingTime deltaTime)
    Parameters
    Type Name Description
    DeltaSamplingTime deltaTime

    The delta time for which the root transform is to be retrieved.

    Returns
    Type Description
    AffineTransform

    The root transform that corresponds to the delta sampling time passed as argument.

    GetTrajectoryTransform(SamplingTime)

    Retrieves the root transform for a sampling time.

    Declaration
    public AffineTransform GetTrajectoryTransform(SamplingTime samplingTime)
    Parameters
    Type Name Description
    SamplingTime samplingTime

    The sampling time for which the root transform is to be retrieved.

    Returns
    Type Description
    AffineTransform

    The root transform that corresponds to the sampling time passed as argument.

    GetTrajectoryTransformBetween(Int32, Int32)

    Calculates the relative root transform displacement between a frame and an offset.

    Declaration
    public AffineTransform GetTrajectoryTransformBetween(int poseIndex, int offset)
    Parameters
    Type Name Description
    Int32 poseIndex

    The reference frame for which the relative root transform should be calculated.

    Int32 offset

    An offset in frames that determines the number of frames that the relative root transform should span.

    Returns
    Type Description
    AffineTransform

    The relative root transform between a reference and offset frame passed as argument.

    GetTrajectoryTransformBetween(SamplingTime, Single)

    Calculates the relative root transform between a sampling time and a delta time in seconds.

    Declaration
    public AffineTransform GetTrajectoryTransformBetween(SamplingTime samplingTime, float deltaTime)
    Parameters
    Type Name Description
    SamplingTime samplingTime

    The reference sampling time for which the relative root transform should be calculated.

    Single deltaTime

    An delta time in seconds that determines the duration that the relative root transform should span.

    Returns
    Type Description
    AffineTransform

    The relative root transform between a sampling time and a delta time in seconds passed as argument.

    GetTypeIndex<T>()

    Converts the generic type into a type index.

    Declaration
    public Binary.TypeIndex GetTypeIndex<T>()
        where T : struct
    Returns
    Type Description
    Binary.TypeIndex

    The type index that corresponds to the generic type.

    Type Parameters
    Name Description
    T
    Remarks

    Given a type passed as generic argument, this method performs a lookup in the types stored in the runtime asset and returns the corresponding type index. This index can then be used to extract reflection information for the given type. The returned type index will be invalid if the generic type passed as argument can not be found in the runtime asset.

    See Also
    Unity.Kinematica.Binary.GetType(System.Int32)

    IndexToTimeInSeconds(Int32)

    Converts a frame index to the corresponding time in seconds.

    Declaration
    public float IndexToTimeInSeconds(int index)
    Parameters
    Type Name Description
    Int32 index

    Frame index to be converted into a time in seconds.

    Returns
    Type Description
    Single

    Time in seconds that corresponds to the frame index passed as argument.

    IsPayload<T>(ref T, Int32)

    Determines whether the specified trait value matches a payload stored in the runtime asset.

    Declaration
    public bool IsPayload<T>(ref T value, int payload)
        where T : struct
    Parameters
    Type Name Description
    T value

    Trait value to check the payload against.

    Int32 payload

    Payload index to check the trait for.

    Returns
    Type Description
    Boolean

    True if the trait value matches the payload store in the runtime asset; false otherwise.

    Type Parameters
    Name Description
    T

    IsType(Binary.MarkerIndex, Binary.TypeIndex)

    Determines whether the specified marker is an instance of the type passed as argument.

    Declaration
    public bool IsType(Binary.MarkerIndex markerIndex, Binary.TypeIndex typeIndex)
    Parameters
    Type Name Description
    Binary.MarkerIndex markerIndex

    The marker to compare with the type.

    Binary.TypeIndex typeIndex

    The type to compare the marker for.

    Returns
    Type Description
    Boolean

    True if the marker is of the specified type; false otherwise.

    IsValid(SamplingTime)

    Determines if a given sampling time is valid.

    Declaration
    public bool IsValid(SamplingTime samplingTime)
    Parameters
    Type Name Description
    SamplingTime samplingTime

    The sampling time to be checked.

    Returns
    Type Description
    Boolean

    True if the specified sampling time is valid; otherwise, false.

    IsValid(TimeIndex)

    Determines if a given time index is valid.

    Declaration
    public bool IsValid(TimeIndex timeIndex)
    Parameters
    Type Name Description
    TimeIndex timeIndex

    The time index to be checked.

    Returns
    Type Description
    Boolean

    True if the specified time index is valid; otherwise, false.

    ReconstructPoseFragment(SamplingTime)

    Reconstructs a pose fragment from the runtime asset that corresponds to a sampling time.

    Declaration
    public Binary.PoseFragment ReconstructPoseFragment(SamplingTime samplingTime)
    Parameters
    Type Name Description
    SamplingTime samplingTime

    The sampling time from which the pose fragment should be reconstructed.

    Returns
    Type Description
    Binary.PoseFragment

    The resulting pose fragment.

    Remarks

    The runtime asset building process generates pose fragments for any segment for which a metric has been defined. These pose fragments are stored inside the runtime asset in a compressed format.

    Pose fragments can either be constructed from scratch or can be reconstructed from the information contained in the runtime asset. Reconstruction is faster than creating a pose fragment but is subject to loss of precision.

    ReconstructTrajectoryFragment(SamplingTime)

    Reconstructs a trajectory fragment for a given sampling time in the runtime asset.

    Declaration
    public Binary.TrajectoryFragment ReconstructTrajectoryFragment(SamplingTime samplingTime)
    Parameters
    Type Name Description
    SamplingTime samplingTime

    The sampling time from which the trajectory fragment should be reconstructed.

    Returns
    Type Description
    Binary.TrajectoryFragment

    The resulting trajectory fragment.

    Remarks

    The runtime asset building process generates trajectory fragments for any segment for which a metric has been defined. These trajectory fragments are stored inside the runtime asset in a compressed format.

    Trajectory fragments can either be constructed from scratch or can be reconstructed from the information contained in the runtime asset. Reconstruction is faster than creating a trajectory fragment but is subject to loss of precision.

    TimeInSecondsToIndex(Single)

    Converts a time in seconds to an index.

    Declaration
    public int TimeInSecondsToIndex(float timeInSeconds)
    Parameters
    Type Name Description
    Single timeInSeconds

    Time in seconds to be converted into an index.

    Returns
    Type Description
    Int32

    Frame index that corresponds to the time in seconds passed as argument.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023