Topic: Z Depth!

Hi,
   Is there a way to disable/enable it for an object whether through script or sdk?

    Thanks.
    Regards.

Re: Z Depth!

Through sdk you can do everything, the difficulty is to do it before drawing an object.
But there is maybe a simpler way, what do you want to do ?

Exemple to disable zbuffer :

MRenderingContext * render = engine->getRenderingontext();

// you can clear zbuffer
render->clear(M_BUFFER_DEPTH);

// or disable depth test completly
render->disableDepthTest(); // re-enable by doing : render->enableDepthTest();

// or just disable writing to depth
render->setDepthMask(1); // re-enable by doing : render->setDepthMask(0);

Re: Z Depth!

That is how I am also doing.
But I only want to disable single object, not the whole level. Say, the gun, stop it to going through walls.

Thanks.
Regards.

Re: Z Depth!

personally, for the player gun in a fps, I would reduce the size of the gun to be sure it's less than the collision box and put it closer to the camera eye.

If you really don't want to change the size, you can do a separate layer like the GUI, and put the 3d gun in a separate scene that you render after the game scene.

Re: Z Depth!

Reducing the size will work fine but putting the gun on a separate layer might cause a problem. It won't get effected by the main scene lights I think.
If you want kindly add it as lua script for the a future release. There are some games which needs it.

Thanks.
Regards.

Re: Z Depth!

I'm not sure about adding an option to disable depth test for a single object, it might cause some problems, for a non-flat object, it will make the polygons of the objects penetrating themselves. It will produce the same problem with shadows, if the object was supposed to penetrate a wall, the wall shadow will still cut the object where he was supposed to penetrate the wall.