[osg-users] Collided nodes in callback
Julien Valentin
julienvalentin51 at gmail.com
Sat May 21 09:30:26 PDT 2016
So you fit my second assertion: you want to manage collision yourself...
One way to achieve that brute force is to use a NodeVisitor that collect all the node (applied in a update callback on the root of your scenegraph) and then do your collide test in your node callback.
But keep in mind the dirty way, broadphase collision detection is a feature inherent to the physics engine and not to the rendering engine...
matus wrote:
> Hi,
> i will try to be more exact on this pseudocode:
>
> Code:
>
> operator() (osg::Node* current, osg::NodeVisitor* nv)
> {
> //i want to get list of nodes which are in collision with current node so i can print it, for example
> std::vector<osg::Node> collided = nv->someCustomMethod(current);
>
> if(!collided.empty())
> {
> for(osg::Node &node : collided)
> {
> std::cout << "collision with node: " + node->getName() << std::endl;
> }
> }
>
>
>
>
>
> There is no need to get this nodes from nodevisotor. I dont care how i will get them as long as i use pure osg not bullet. This code is just example.
>
> Thank you!
>
> Cheers,
> Matus
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67187#67187
More information about the osg-users
mailing list