Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

PhysicsBody.SetBatchTransform

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void SetBatchTransform(ReadOnlySpan<BatchTransform> batch);

Parameters

Parameter Description
batch The batch of bodies and values to set.

Description

Set the transform for a batch of PhysicsBody using a span of BatchTransform. 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.


Declaration

public static void SetBatchTransform(ReadOnlySpan<BatchTransform> batch, bool writePoses);

Parameters

Parameter Description
batch The batch of bodies and values to set.
writePoses Whether to also write the poses to the PhysicsBody.transformObject of each body in the batch.

Description

Set the transform for a batch of PhysicsBody using a span of BatchTransform, optionally writing each pose to the PhysicsBody.transformObject of its body. If invalid values are passed to the batch, they will simply be ignored. When writePoses is true, each pose set is also written to the PhysicsBody.transformObject of its body, without producing a TransformChangeEvent. Writing poses requires all the valid bodies in the batch to be in the same PhysicsWorld and each to have its own PhysicsBody.transformObject assigned, not shared with another body in the batch. Invalid bodies in the batch are still simply ignored. The PhysicsWorld.transformWriteMode and PhysicsBody.transformWriteMode do not control this explicit write, except that PhysicsWorld.TransformWriteMode.Fast2D selects the faster rotation write. Writing poses must be done on the main thread.