SetBatchGeometry
Set a batch of PhysicsShape to the corresponding CircleGeometry. The two spans must be the same length; shape[i] is set to geometry[i]. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes or geometry in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
Read time 7 minutesLast updated 13 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, ReadOnlySpan<CircleGeometry>)
Set a batch of PhysicsShape to the corresponding CircleGeometry. The two spans must be the same length; shape[i] is set to geometry[i]. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes or geometry in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, ReadOnlySpan<CircleGeometry> geometry)
Parameters
The shapes to set.
The geometry to set on each corresponding shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, ReadOnlySpan<CapsuleGeometry>)
Set a batch of PhysicsShape to the corresponding CapsuleGeometry. The two spans must be the same length; shape[i] is set to geometry[i]. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes or geometry in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, ReadOnlySpan<CapsuleGeometry> geometry)
Parameters
The shapes to set.
The geometry to set on each corresponding shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, ReadOnlySpan<PolygonGeometry>)
Set a batch of PhysicsShape to the corresponding PolygonGeometry. The two spans must be the same length; shape[i] is set to geometry[i]. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes or geometry in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, ReadOnlySpan<PolygonGeometry> geometry)
Parameters
The shapes to set.
The geometry to set on each corresponding shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, ReadOnlySpan<SegmentGeometry>)
Set a batch of PhysicsShape to the corresponding SegmentGeometry. The two spans must be the same length; shape[i] is set to geometry[i]. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes or geometry in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, ReadOnlySpan<SegmentGeometry> geometry)
Parameters
The shapes to set.
The geometry to set on each corresponding shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, ReadOnlySpan<ChainSegmentGeometry>)
Set a batch of PhysicsShape to the corresponding ChainSegmentGeometry. The two spans must be the same length; shape[i] is set to geometry[i]. If a shape is already a chain segment, its owning chain is preserved. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes or geometry in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, ReadOnlySpan<ChainSegmentGeometry> geometry)
Parameters
The shapes to set.
The geometry to set on each corresponding shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, CircleGeometry)
Set a batch of PhysicsShape all to the same CircleGeometry. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, CircleGeometry geometry)
Parameters
The shapes to set.
The geometry to set on every shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). If the geometry is invalid, no shapes are set. |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, CapsuleGeometry)
Set a batch of PhysicsShape all to the same CapsuleGeometry. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, CapsuleGeometry geometry)
Parameters
The shapes to set.
The geometry to set on every shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). If the geometry is invalid, no shapes are set. |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, PolygonGeometry)
Set a batch of PhysicsShape all to the same PolygonGeometry. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, PolygonGeometry geometry)
Parameters
The shapes to set.
The geometry to set on every shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). If the geometry is invalid, no shapes are set. |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, SegmentGeometry)
Set a batch of PhysicsShape all to the same SegmentGeometry. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, SegmentGeometry geometry)
Parameters
The shapes to set.
The geometry to set on every shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). If the geometry is invalid, no shapes are set. |
SetBatchGeometry(ReadOnlySpan<PhysicsShape>, ChainSegmentGeometry)
Set a batch of PhysicsShape all to the same ChainSegmentGeometry. If a shape is already a chain segment, its owning chain is preserved. Like the single geometry setters, this updates the shape type and broadphase but does not update body mass. Call PhysicsBody.ApplyMassFromShapes on any affected body if a mass update is required. Invalid shapes in the batch are ignored. For best performance, the shapes should all be part of the same PhysicsWorld, sorted by world otherwise.
public static int SetBatchGeometry(ReadOnlySpan<PhysicsShape> shapes, ChainSegmentGeometry geometry)
Parameters
The shapes to set.
The geometry to set on every shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). If the geometry is invalid, no shapes are set. |