docs.unity3d.com
    Show / Hide Table of Contents

    Struct Simulation

    Steps a physics world.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Physics
    Syntax
    public struct Simulation : ISimulation, IDisposable

    Properties

    CollisionEvents

    Gets the collision events.

    Declaration
    public readonly CollisionEvents CollisionEvents { get; }
    Property Value
    Type Description
    CollisionEvents

    The collision events.

    Contacts

    Gets the contacts stream.

    Declaration
    public readonly NativeStream Contacts { get; }
    Property Value
    Type Description
    NativeStream

    The contacts stream-->.

    FinalJobHandle

    Gets the handle of the final job.

    Declaration
    public readonly JobHandle FinalJobHandle { get; }
    Property Value
    Type Description
    JobHandle

    The final job handle.

    Implements
    ISimulation.FinalJobHandle

    FinalSimulationJobHandle

    Gets the handle of the final simulation job (not including dispose jobs).

    Declaration
    public readonly JobHandle FinalSimulationJobHandle { get; }
    Property Value
    Type Description
    JobHandle

    The final simulation job handle.

    Implements
    ISimulation.FinalSimulationJobHandle

    ImpulseEvents

    Gets the impulse events.

    Declaration
    public readonly ImpulseEvents ImpulseEvents { get; }
    Property Value
    Type Description
    ImpulseEvents

    The impulse events.

    TriggerEvents

    Gets the trigger events.

    Declaration
    public readonly TriggerEvents TriggerEvents { get; }
    Property Value
    Type Description
    TriggerEvents

    The trigger events.

    Type

    Gets the simulation type.

    Declaration
    public readonly SimulationType Type { get; }
    Property Value
    Type Description
    SimulationType

    UnityPhysics.

    Implements
    ISimulation.Type

    Methods

    Create()

    Creates a new Simulation.

    Declaration
    public static Simulation Create()
    Returns
    Type Description
    Simulation

    A Simulation.

    Dispose()

    Disposes the simulation.

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    ScheduleBroadphaseJobs(SimulationStepInput, JobHandle, Boolean)

    Schedule broadphase jobs.

    Declaration
    public SimulationJobHandles ScheduleBroadphaseJobs(SimulationStepInput input, JobHandle inputDeps, bool multiThreaded = true)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    JobHandle inputDeps

    The input deps.

    Boolean multiThreaded

    (Optional) True if multi threaded.

    Returns
    Type Description
    SimulationJobHandles

    The SimulationJobHandles.

    ScheduleCreateJacobiansJobs(SimulationStepInput, JobHandle, Boolean)

    Schedule create jacobians jobs.

    Declaration
    public SimulationJobHandles ScheduleCreateJacobiansJobs(SimulationStepInput input, JobHandle inputDeps, bool multiThreaded = true)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    JobHandle inputDeps

    The input deps.

    Boolean multiThreaded

    (Optional) True if multi threaded.

    Returns
    Type Description
    SimulationJobHandles

    The SimulationJobHandles.

    ScheduleNarrowphaseJobs(SimulationStepInput, JobHandle, Boolean)

    Schedule narrowphase jobs.

    Declaration
    public SimulationJobHandles ScheduleNarrowphaseJobs(SimulationStepInput input, JobHandle inputDeps, bool multiThreaded = true)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    JobHandle inputDeps

    The input deps.

    Boolean multiThreaded

    (Optional) True if multi threaded.

    Returns
    Type Description
    SimulationJobHandles

    The SimulationJobHandles.

    ScheduleSolveAndIntegrateJobs(SimulationStepInput, JobHandle, Boolean)

    Schedule solve and integrate jobs.

    Declaration
    public SimulationJobHandles ScheduleSolveAndIntegrateJobs(SimulationStepInput input, JobHandle inputDeps, bool multiThreaded = true)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    JobHandle inputDeps

    The input deps.

    Boolean multiThreaded

    (Optional) True if multi threaded.

    Returns
    Type Description
    SimulationJobHandles

    The SimulationJobHandles.

    ScheduleStepJobs(SimulationStepInput, JobHandle, Boolean)

    Schedule all the jobs for the simulation step. Enqueued callbacks can choose to inject additional jobs at defined sync points. multiThreaded defines which simulation type will be called:

    • true will result in default multithreaded simulation
    • false will result in a very small number of jobs (1 per physics step phase) that are scheduled sequentially Behavior doesn't change regardless of the multiThreaded argument provided.
    Declaration
    public SimulationJobHandles ScheduleStepJobs(SimulationStepInput input, JobHandle inputDeps, bool multiThreaded = true)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    JobHandle inputDeps

    The input deps.

    Boolean multiThreaded

    (Optional) True if multi threaded.

    Returns
    Type Description
    SimulationJobHandles

    The SimulationJobHandles.

    Implements
    ISimulation.ScheduleStepJobs(SimulationStepInput, JobHandle, Boolean)

    Step(SimulationStepInput)

    Steps the world immediately.

    Declaration
    public void Step(SimulationStepInput input)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    Implements
    ISimulation.Step(SimulationStepInput)

    StepImmediate(SimulationStepInput, ref SimulationContext)

    Steps the simulation immediately on a single thread without spawning any jobs.

    Declaration
    public static void StepImmediate(SimulationStepInput input, ref SimulationContext simulationContext)
    Parameters
    Type Name Description
    SimulationStepInput input

    The input.

    SimulationContext simulationContext

    [in,out] Context for the simulation.

    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