it is based on some old code i had which was actually used for ai
pretty crazy
![Laughing :lol:](./images/smilies/icon_lol.gif)
it works on this principle (they diagram is horrible but the code will explain
![Image](http://img319.imageshack.us/img319/1018/ai9dv.jpg)
all of it is in the update loop
any way it starts with this
Code: Select all
core::vector3df pos=camera->getAbsolutePosition();
core::vector3df selfrot=camera->getRotation();
core::vector3df targetpos=node->getAbsolutePosition();
core::vector3df targetrot;
targetrot=getTargetAngle(pos,targetpos);
f32 rotadd=targetrot.Y-selfrot.Y;
then the fun part
the 60 value is 0 deg +60
the 300 valueis 360 -60 deg
there fore giving the camera 120 deg of fov if the node is out side that cull it
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
Code: Select all
if(rotadd>60 & rotadd<300 ){
node->setVisible(true);
}
else
node->setVisible(false);
[code]
it is useful for animated things as the octree node doesnt allow animation
i know it is simple and not complete tell me what u think
bye