docs.unity3d.com
    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
    Namespace: UnityEngine.Perception.Randomization.Samplers
    Syntax
    public class AnimationCurveSampler : object, ISampler

    Constructors

    AnimationCurveSampler()

    Constructs a default AnimationCurveSampler

    Declaration
    public AnimationCurveSampler()

    AnimationCurveSampler(AnimationCurve, Int32)

    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

    Int32 numberOfSamples

    Number of samples used for integrating over the provided AnimationCurve

    Fields

    distributionCurve

    The Animation Curve associated with this sampler

    Declaration
    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
    public int numOfSamplesForIntegration
    Field Value
    Type Description
    Int32

    Properties

    maxAllowed

    The largest value this sampler should output

    Declaration
    public float maxAllowed { get; set; }
    Property Value
    Type Description
    Single
    Implements
    ISampler.maxAllowed

    minAllowed

    The smallest value this sampler should output

    Declaration
    public float minAllowed { get; set; }
    Property Value
    Type Description
    Single
    Implements
    ISampler.minAllowed

    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
    Boolean
    Implements
    ISampler.shouldCheckValidRange

    Methods

    CheckAgainstValidRange()

    Declaration
    public void CheckAgainstValidRange()
    Implements
    ISampler.CheckAgainstValidRange()

    Sample()

    Generates one sample

    Declaration
    public float Sample()
    Returns
    Type Description
    Single

    The generated sample

    Implements
    ISampler.Sample()

    Validate()

    Validates that the sampler is configured properly

    Declaration
    public void Validate()
    Implements
    ISampler.Validate()
    Exceptions
    Type Condition
    UnityEngine.Perception.Randomization.Samplers.SamplerValidationException
    Back to top
    Terms of use
    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