docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AnimationCurveSampler

    Returns random values according to a range and probability distribution denoted by a user provided AnimationCurve. The X axis of the AnimationCurve corresponds to the values this sampler will pick from, and the Y axis corresponds to the relative probability of the values. The relative probabilities (Y axis) do not need to max out at 1, as only the shape of the curve matters. The Y values cannot however be negative.

    Inheritance
    object
    AnimationCurveSampler
    Implements
    ISampler
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Perception.Randomization.Samplers
    Assembly: Unity.Perception.Runtime.dll
    Syntax
    [Serializable]
    public class AnimationCurveSampler : ISampler

    Constructors

    AnimationCurveSampler()

    Constructs a default AnimationCurveSampler

    Declaration
    public AnimationCurveSampler()

    AnimationCurveSampler(AnimationCurve, int)

    Constructs an AnimationCurveSampler with a given animation curve

    Declaration
    public AnimationCurveSampler(AnimationCurve curve, int numberOfSamples = 500)
    Parameters
    Type Name Description
    AnimationCurve curve

    The animation curve to sample from

    int numberOfSamples

    Number of samples used for integrating over the provided AnimationCurve

    Fields

    distributionCurve

    The Animation Curve associated with this sampler

    Declaration
    [Tooltip("Probability distribution curve used for this sampler. The X axis corresponds to the values this sampler will pick from, and the Y axis corresponds to the relative probability of the values. The relative probabilities (Y axis) do not need to max out at 1 as only the shape of the curve matters. The Y values cannot however be negative.")]
    public AnimationCurve distributionCurve
    Field Value
    Type Description
    AnimationCurve

    numOfSamplesForIntegration

    Number of samples used for integrating over the provided AnimationCurve. The larger the number of samples, the more accurate the resulting probability distribution will be.

    Declaration
    [Tooltip("Number of internal samples used for integrating over the provided AnimationCurve. The larger the number of samples, the more accurately the resulting probability distribution will follow the provided AnimationCurve. Increase this if the default value proves insufficient.")]
    public int numOfSamplesForIntegration
    Field Value
    Type Description
    int

    Properties

    maxAllowed

    The largest value this sampler should output

    Declaration
    public float maxAllowed { get; set; }
    Property Value
    Type Description
    float

    minAllowed

    The smallest value this sampler should output

    Declaration
    public float minAllowed { get; set; }
    Property Value
    Type Description
    float

    shouldCheckValidRange

    Whether the provided minAllowed and maxAllowed values should be used to validate this sampler.

    Declaration
    public bool shouldCheckValidRange { get; set; }
    Property Value
    Type Description
    bool

    Methods

    CheckAgainstValidRange()

    Checks if range valid

    Declaration
    public void CheckAgainstValidRange()
    Exceptions
    Type Condition
    NotImplementedException

    Sample()

    Generates one sample

    Declaration
    public float Sample()
    Returns
    Type Description
    float

    The generated sample

    Validate()

    Validates that the sampler is configured properly

    Declaration
    public void Validate()
    Exceptions
    Type Condition
    SamplerValidationException

    Implements

    ISampler
    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)