Skip to content

Commit 013698b

Browse files
committed
improved body.parts docs
1 parent 411af06 commit 013698b

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/body/Body.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ var Axes = require('../geometry/Axes');
380380
*
381381
* See `body.parts` for details and requirements on how parts are used.
382382
*
383+
* See Bodies.fromVertices for a related utility.
384+
*
383385
* This function updates `body` mass, inertia and centroid based on the parts geometry.
384386
* Sets each `part.parent` to be this `body`.
385387
*
@@ -927,17 +929,24 @@ var Axes = require('../geometry/Axes');
927929
/**
928930
* _Read only_. Use `Body.setParts` to set.
929931
*
932+
* See `Bodies.fromVertices` for a related utility.
933+
*
930934
* An array of bodies (the 'parts') that make up this body (the 'parent'). The first body in this array must always be a self-reference to this `body`.
931935
*
932-
* The parts are fixed together and will move and rotate as a single rigid body.
936+
* The parts are fixed together and therefore perform as a single unified rigid body.
933937
*
934-
* Parts when combined are allowed to overlap, form gaps, have holes so can be used to create complex concave bodies unlike bodies with a single part.
938+
* Parts in relation to each other are allowed to overlap, as well as form gaps or holes, so can be used to create complex concave bodies unlike when using a single part.
935939
*
936-
* Only the geometry of the parts is considered, e.g. the individual material properties of parts (e.g. `part.friction`) are not used in favour of the parent body's properties.
940+
* Use properties and functions on the parent `body` rather than on parts.
941+
*
942+
* Outside of their geometry, most properties on parts are not considered or updated.
943+
* As such 'per-part' material properties among others are not currently considered.
937944
*
938-
* Parts individual vertices must still be convex.
945+
* Parts should be created specifically for their parent body.
946+
* Parts should not be shared or reused between bodies, only one parent is supported.
939947
* Parts should not have their own parts, they are not handled recursively.
940-
* Parts should not be added to the world directly or any other body or composite.
948+
* Parts should not be added to the world directly or any other composite.
949+
* Parts own vertices must be convex and in clockwise order.
941950
*
942951
* A body with more than one part is sometimes referred to as a 'compound' body.
943952
*

0 commit comments

Comments
 (0)