Plush

ShapeCollection#

plupy · Type index

Module: plupy · obtained from plupy.data.shapes

plupy.data.shapes: physics shapes, made fitted to an object's mesh or by kind and size.

class ShapeCollection(DataCollection)

Inherits DataCollection: its members are documented there.

Usage and examples

Members: new

new#

new(name: str | None=None, *, fit: Object | None=None, kind: str | None=None, mesh: Mesh | None=None, **sizes) -> DataBlock

A physics shape: fitted to an object's mesh with fit=object (box, sphere or convex hull), or kind="Box" (sizeX/sizeY/sizeZ), "Sphere" (radius), "Capsule" (radius, height), "ConvexHull" or "TriangleMesh" (optional mesh=).

A Rigid Body (physicsBody component) collides through a physics shape. fit=obj makes one sized to that object's mesh, as the editor's New physics shape does: a box for a box or cube mesh, a sphere for a sphere, otherwise the mesh's convex hull. kind= makes one directly: "Box" (sizeX, sizeY, sizeZ), "Sphere" (radius), "Capsule" (radius, height), "ConvexHull" or "TriangleMesh" (optional mesh=; without one the body's own mesh is used). Assign it with physics.shape; physics.motion is "Static", "Kinematic" or "Dynamic" (with physics.mass):

crate = plupy.data.objects["Crate"]
body = crate.components.add("physicsBody")
body.props["physics.shape"] = plupy.data.shapes.new(fit=crate)
body.props["physics.motion"] = "Dynamic"
body.props["physics.mass"] = 8

A shape is shared data: every object using it collides the same way, so one shape per prop kind is enough.

DataBlock · DataCollection · Mesh · Object

Source#