SetBatchVelocity(ReadOnlySpan<BatchVelocity>)
Set the velocity for a batch of PhysicsBody using a span of PhysicsBody.BatchVelocity. If invalid values are passed to the batch, they will simply be ignored. For best performance, the bodies contained in the batch should all be part of the same PhysicsWorld. If the bodies in the batch are not contained in the same PhysicsWorld, the batch should be sorted by the PhysicsWorld the bodies are contained within.
Read time 1 minuteLast updated 2 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public static int SetBatchVelocity(ReadOnlySpan<PhysicsBody.BatchVelocity> batch)
Parameters
The batch of bodies and values to set.
Returns
Type | Description |
|---|---|
| int | The number of bodies that were ignored (not set because the body was invalid). A single warning is logged when any are ignored. |