How to reset a collision solid?


I need to build a collision box and to chenge her size on the fly.

I don’t want to alloc a new collision box and/or to add new solid to the collision node how can I do it?

10x !

You can always setScale() the node that contains the box.


Thanks for the quick reply!

So I assume there is no other why…?

Becuse I need to deploy my box by the drag of the mouse, and it’s not very friendly to deploy it and convert the mouse postion to a scale values…

If I could reset it by the main diagonal (like i build it) it wild be the best wey…

It doesn’t appear that CollisionBox supports this. Your three choices are:

(1) Add the required API’s to CollisionBox to support this. Not difficult.
(2) Destroy and recreate the CollisionBox each time you want to change it. Not really unreasonable.
(3) Create a unit-size CollisionBox and use set_scale() to change its size. May be a little unreliable, depending on the CollisionBox implementation.

The short answer is, the CollisionBox was implemented as part of a student project over a summer, and it is not as robust as some of the other collision solids. If you would like to contribute to the code and make it more robust, we’d be happy to accept your contributions. :slight_smile:


I love to try and contribute to the code.
Where can i find the .cpp files of the CollisioBox?

In the panda/src/collide directory of the source.