Collision in Roaming Ralph (C++ version)


When studying the c++ version of the Roaming Ralph sample, looking for information on how to use an egg file that contains the Collide-tag for collision detection, I came across something that astonished me:

To my utmost surprise, nothing further is done with environ - it is not added as a collider to a collision handler or anything else. Now I reasoned that the Collide-tag must somehow take care of it.
First of all: Is this assumption correct? And if it is, what if I want to set the model’s collision handler, explicitly? I have tried adding it to a CollisionHandlerPusher via coll_handler.add_collider(…), but it would give me a warning stating that the node was not of the type CollisionNode.

In anticipation of your answers,

You are getting confused between “from” solids and “into” solids. As described in the manual, “from” solids are explicitly created and attached to a CollisionTraverser and a CollisionHandler. On the other hand, “into” solids are implicitly loaded and are simply found in the scene graph when the CollisionTraverser does its thing.

The tag in the environ model does indeed create some collision solids, and since nothing is done with them they remain “into” solids, which is correct. The only “from” solids are attached to Ralph himself.


Aha! Thank you for pointing that out to me. As a matter of fact, I did not mix up “from” solids and “into” solids, but simply thought that “into” solids had CollisionHandlers, too.

Thanks for clarifying :wink: