文档

Unity Engine

Unity Engine

Simulate

Simulate the world. If deltaTime is zero then only contact and trigger events will be updated and no velocity or position integration or constraint updates will occur.
阅读时间1 分钟最后更新于 21 天前

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

Simulate(float)

Simulate the world. If
deltaTime
is zero then only contact and trigger events will be updated and no velocity or position integration or constraint updates will occur.
public void Simulate(float deltaTime)

Parameters

deltaTime

The amount of time to forward simulate the world.

Simulate(ReadOnlySpan<PhysicsWorld>, float)

Simulate a batch of worlds. If
deltaTime
is zero then only contact and trigger events will be updated and no velocity or position integration or constraint updates will occur. The worlds can be simulated concurrently depending on the setting of PhysicsCoreSettings2D.concurrentSimulations.
public static int Simulate(ReadOnlySpan<PhysicsWorld> worlds, float deltaTime)

Parameters

The worlds to forward simulate.

deltaTime

The amount of time to forward simulate the world.

Returns

Type

Description

intThe number of worlds that were ignored (not simulated because the world was invalid). A single warning is logged when any are ignored. If the delta time is invalid, nothing is simulated and every world is counted as ignored.