ZBuffer Problem

Im creating a liitle game…

I created a sphere to be the player avatar, a box to be the ground and 4 more boxes to be the walls around the ground…

My problem: the walls keep appearing and disappearing as player avatar moves

This is the source

 * To change this template, choose Tools | Templates
 * and open the template in the editor.

package menusystemprototype;

import com.jme.app.BaseGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.image.Texture;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.light.DirectionalLight;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.CameraNode;
import com.jme.scene.Node;
import com.jme.scene.Skybox;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.TextureManager;
import com.jme.util.Timer;

 * Menu System for Project Endless Prototype
 * @author Tiago Jos

Do you call "updateModelBound();" for the walls?

It sounds like the bounding boxes for view-frustum culling are not right.


by the way what does .updateModelBound() does? LOL

You are welcome. :slight_smile:

updateModelBound() calculates the bounding boxes of a node.

This boxes are used for the view-frustum culling. When the bounding box of a node is outside the view-frustrum, the node will not be rendered, so the bounding box has to be always bigger or of the same size than the node.