# RigidBodyCombiner¶

class RigidBodyCombiner

Bases: PandaNode

This is a special node that combines multiple independently-moving rigid nodes into one Geom internally (or as few Geoms as possible), for the purposes of improving rendering performance.

To use it, parent a number of moving objects to this node and call collect(). A child node is identified as “moving” if (a) it has a non- identity transform initially, or (b) it is a ModelNode with the preserve_transform flag set. Any other nodes will be considered static, and later transforms applied to them will not be identified.

You should call collect() only at startup or if you change the set of children; it is a relatively expensive call.

Once you call collect(), you may change the transforms on the child nodes freely without having to call collect() again.

RenderEffects such as Billboards are not supported below this node.

Inheritance diagram

explicit RigidBodyCombiner(std::string const &name)
void collect(void)

Walks through the entire subgraph of nodes rooted at this node, accumulates all of the RenderAttribs and Geoms below this node, flattening them into just one Geom (or as few as possible, if there are multiple different states).

Nodes that have transforms on them at the time of collect(), or any ModelNodes with the preserve_transform flag, will be identified as “moving” nodes, and their transforms will be monitored as they change in future frames and each new transform directly applied to the vertices.

This call must be made after adding any nodes to or removing any nodes from the subgraph rooted at this node. It should not be made too often, as it is a relatively expensive call. If you need to hide children of this node, consider scaling them to zero (or very near zero), or moving them behind the camera, instead.

static TypeHandle get_class_type(void)
NodePath get_internal_scene(void)

Returns a special NodePath that represents the internal node of this object. This is the node that is actually sent to the graphics card for rendering; it contains the collection of the children of this node into as few Geoms as possible.

This node is filled up by the last call to collect().