# Orx Learning

### Site Tools

en:tutorials:z_order_of_objects_with_joints

# Differences

This shows you the differences between two versions of the page.

 — en:tutorials:z_order_of_objects_with_joints [2018/08/13 03:34 (11 months ago)] (current)sausage created 2018/08/13 03:34 (11 months ago) sausage created 2018/08/13 03:34 (11 months ago) sausage created Line 1: Line 1: + ====== Z-Order of Objects with Joints ====== + This is a very small tutorial, and the main point is going to be this: + + Joints use ''​ParentAnchor''​ and ''​ChildAnchor''​ for connecting, however the z coordinate of the ''​Position''​ property is super important for getting the z order of your objects right. + + I could leave it there, but I'll show code to illustrate: + + <​code>​ + + [Robot] + Graphic ​       = RobotGraphic + Position ​      = (0, 0, 0) ;robot sits at dead centre and 0 z-index + ChildList ​     = LeftWheel + ChildJointList = WeldLeftWheelJoint + Body           = RobotBody + + [RobotGraphic] + Texture = robot-inside.png + Pivot   = center + + [RobotBody] + Dynamic ​ = true + PartList = RobotBodyPart ​ + + [RobotBodyPart] + Type = box + Solid = true + + + ​ + + + Then for the wheel that attaches to the robot: + + <​code>​ + + [WheelGraphic] + Texture = wheel.png + Pivot   = center + + [LeftWheel] + Graphic ​ = WheelGraphic + Position = (0, 0, -0.5) ; Here's the point. Make the wheel sit on top of the robot. + Body     = LeftWheelBody + + [WeldLeftWheelJoint] + Type = weld + ParentAnchor = (-50, 40, 0) + ChildAnchor = (10, 10, 0) ; weld here, but don't bother with the z coord. + Collide = false + + [LeftWheelBody] + Mass     = 10 + Density ​ = 0.5 + Dynamic ​ = true + PartList = LeftWheelBodyPart + + [LeftWheelBodyPart] + Type  = box + Solid = true + + ​ + + That should help you ensure the order that joints are drawn.
en/tutorials/z_order_of_objects_with_joints.txt ยท Last modified: 2018/08/13 03:34 (11 months ago) by sausage