irr::scene::IMeshSceneNode * node1 = .... ; // replace ... by whatever method you use to get your node
irr::scene::IMeshSceneNode * node2 = .... ; // replace ... by whatever method you use to get your node
irr::f32 minRadius1 = node1->getMesh()->getBoundingBox().getExtent().getLength() * 0.5f; // maximal radius the mesh will have
irr::f32 minRadius2 = node1->getMesh()->getBoundingBox().getExtent().getLength() * 0.5f; // maximal radius the mesh will have
irr::f32 distance = node1->getAbsolutePosition().getDistanceFrom(node2->getAbsolutePosition());
if ( distance < minRadius1+minRadius2 )
{
node2->remove(); // or sometimes you just hide it with node2->setVisible(false), depends on the situation
}
scene::IAnimatedMeshSceneNode* node2 ;
scene::IAnimatedMeshSceneNode* node3;
node2=smgr->addAnimatedMeshSceneNode(smgr->getMesh("ninja.b3d"),0,-1);
node3=smgr->addAnimatedMeshSceneNode(smgr->getMesh("ninja.b3d"),camera,-1);
f32 minRadius1 = node3->getMesh()->getBoundingBox().getExtent() * 0.5f;
f32 minRadius2 = node3->getMesh()->getBoundingBox().getExtent() * 0.5f;
f32 distance = node1->getAbsolutePosition().getDistanceFrom(node2->getAbsolutePosition());
if ( distance < minRadius1+minRadius2 )
{
node2->setVisible(false);
}
core::vector3df minRadius1 = node3->getMesh()->getBoundingBox().getExtent() * 0.5f;
core::vector3df minRadius2 = node2->getMesh()->getBoundingBox().getExtent() * 0.5f;
f32 distance = node1->getAbsolutePosition().getDistanceFrom(node2->getAbsolutePosition());
if ( distance<(minRadius1+minRadius2))
{
node2->setVisible(false);
}
if(distance < (minRad1+minRad2).getLenght() )if( (distance*distance) < (minRad1+minRad2).getLenghtSQ() )
smgr->drawAll();
core::vector3df minRadius1 = node3->getMesh()->getBoundingBox().getExtent() * 0.5f;
core::vector3df minRadius2 = node2->getMesh()->getBoundingBox().getExtent() * 0.5f;
f32 distance = node3->getAbsolutePosition().getDistanceFrom(node2->getAbsolutePosition());
if ((distance*distance)<(minRadius1+minRadius2).getLengthSQ())
{
node2->remove();
}
guienv->drawAll();
chaiein wrote: ... but its not getting invisible/remove but the errors are cleared.
core::vector3df minRadius1 = node3->getMesh()->getBoundingBox().getExtent()*2.5f;
core::vector3df minRadius2 = node2->getMesh()->getBoundingBox().getExtent()*2.5f;
f32 distance = node3->getAbsolutePosition().getDistanceFrom(node2->getAbsolutePosition());
f32 temp;
temp=(minRadius1+minRadius2).getLength();
if ( distance<temp)
{
node3->setFrameLoop(134,145);
node2->setFrameLoop(166,173);
}Users browsing this forum: No registered users and 1 guest