//detect a collision with the camera
if(camera->getTransformedBoundingBox().intersectsWithBox(
cubeOne->getTransformedBoundingBox()))
{//set cube invisible if intersecting with camera
cubeOne->setVisible(false);
}
but it does not work correctly. As is the cube is always invisible. Commenting it out allows the cube to remain visisble. Negating the check allows the cube to remain visible until the camera moves. What am I missing here?
Last edited by onesixtyfourth on Fri Oct 07, 2011 2:43 pm, edited 1 time in total.
f32 camHalfsize = 1.0f; // how big?!
core::vector3df camExtent(camHalfsize);
core::vector3df camPos(camera->getAbsolutePosition());
core::aabbox3df camBox; // camera aabbox in WS
camBox.MinEdge = camPos - camExtent;
camBox.MaxEdge = camPos + camExtent;
//set cube invisible if intersecting with camera or visible if not
cubeOne->setVisible(!camBox.intersectsWithBox(cubeOne->getTransformedBoundingBox()));
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."