Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

PhysicsBody.drawDepth

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

public float drawDepth;

Description

The depth this body is drawn at, in world space, along the axis perpendicular to the world's transform plane.

Bodies are drawn in two dimensions, so the depth is what places a body in front of or behind other things in the scene. The depth axis is Z for PhysicsWorld.TransformPlane.XY, Y for PhysicsWorld.TransformPlane.XZ and X for PhysicsWorld.TransformPlane.ZY. The depth is only used when the body has no PhysicsBody.transformObject. A body with a transform object is always drawn at the depth of that transform. Everything drawn for the body, such as its shapes and its transform axis, uses this depth. A joint is drawn at the depth of its first body, PhysicsJoint.bodyA. A value that is not finite is rejected and leaves the depth unchanged. The depth only changes how the body is drawn and never affects the simulation. See PhysicsBodyDefinition.drawDepth. To set the depth for custom drawing that is not tied to a body, use PhysicsWorld.drawDepth.