Hi,

My name is Leandro and I'm spanish student, I'm working with OSGArt, that is a 
library to integrate OSG + ARToolKit in Ubuntu 10.10.

I think the OSG developers has done a great work with OSG and I want thank you.

I'm using OSG with two markers, they control each MatrixTransform and I can 
draw objects like balls or cones.
I want to control the collision between these objects, my problem is que 
relatives coordinates, I can't get the same coordinates when the objects are in 
the same position.

I've tried several things like this:



Code:
osg::Vec3 OsgArt::getWorldCenter(osg::MatrixTransform* mt)
{
osg::MatrixList worldMatrices = mt->getWorldMatrices();
for(osg::MatrixList::iterator itr = worldMatrices.begin(); itr != 
worldMatrices.end(); ++itr)
{
osg::Matrix& matrix = *itr;
osg::Vec3 center = mt->getBound().center() * matrix;
std::cout<<"Node"<<mt->getName();
std::cout<<"center="<<center;
std::cout<<"worldMatrix="<<cameraMatrix<<std::endl;
return center;
}
}




or


Code:
computeLocalToWorldMatrix (osg::Matrix &matrix, osg::NodeVisitor *nv) 
Get the transformation matrix which moves from local coords to world coords.
computeWorldToLocalMatrix (osg::Matrix &matrix, osg::NodeVisitor *nv)
Get the transformation matrix which moves from world coords to local coords. 



and I also tried this:


Code:
const osg::BoundingSphere& bs1 = movingObject->getPat().getBound();
const osg::BoundingSphere& bs2 = stationaryObject->getPat().getBound();
if(bs1.intersects(bs2)){
cout << "Collision OK";
}



Anyone did something similar? ¿Could someone help me, please?


Thank you!

Cheers,
Leandro.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=40206#40206





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to