changing distance from camera before nodes are not drawn

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Evil Mr Sock
Posts: 37
Joined: Fri Jul 02, 2004 5:36 pm
Location: Albany, NY
Contact:

changing distance from camera before nodes are not drawn

Post by Evil Mr Sock »

Okay, here's what i've done -
I'm making an overhead shooter, and for aesthetic appeal more than anything else, I've decided to use terrain maps underneath the ship, as well as 3D bullets (sure, most of the bullets could be made 2D, but since some will need to be 3D, I'd rather treat them all the same)

I've got the camera pointing straight down and moving forward at the same speed as the ship's default speed - so basically, you're scrolling over a map - this may not be the best way to do scrolling, but I figure if I end up putting turret guns and the like on the terrain map, it'll be easier to move the jet and the camera than the map and all its contents.

So my demo starts up and the little patch of land soon disappears. The ship continues increasing its z_position, and eventually, the 8000 vertices of small but pretty map tile gets dropped from the list.

This takes about 10 seconds to happen after the map is no longer visible in the window.

The same thing occurs with my bullets - they shoot forth and off the top of the screen, clogging up the triangle count, until a while later, they stop being drawn.

Now, I could check the x,z position to my window for each object and say "if you're outside of this, go ahead and remove this node" - and for the bullets, I probably will, to keep the array a reasonable size, since I assume the node is just not drawn rather than removed.

But if irrlicht is saying at a certain point, "you're too far away from the camera, don't draw you" anyway, I'd rather let that automatic function do the work.

How/where do I change the distance from the camera before this kicks in?
------------------------------------------
A monkey poured coffee in my boots.
------------------------------------------
Mindl
Posts: 16
Joined: Wed Jun 30, 2004 1:42 am

Post by Mindl »

I think you want to set the far value of your camera with camera->setFarValue(f32) the default is 2000.0.f. This sets the far clipping plain to 2000.0f units. So raising or lowering it will affect how long it will take for the map and bullets to stop rendering. Hope this helps.

-Mindl
Post Reply