Struct Simulation
Steps a physics world.
Inherited Members
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
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
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 |
Implements
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
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
Step(SimulationStepInput)
Steps the world immediately.
Declaration
public void Step(SimulationStepInput input)
Parameters
Type | Name | Description |
---|---|---|
SimulationStepInput | input | The input. |
Implements
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. |