How to make a first person camera? (Like minecraft's)

A few issues with my minecraft like program

-Trying to get a first person camera

-Lag when more then 50 or so blocks are in view



How should i fix these problems? Thanks!

What kinda mesh are you using for blocks? Isn’t it box meshes, is it?

glaucomardano said:
What kinda mesh are you using for blocks? Isn't it box meshes, is it?


[java]
public static void renderGameBlock(GameBlock current){
/*
* Grab block information (pre render)
*/

Location3D loc = current.get3DLocation();
blocks.add(current);

Box b = new Box(new Vector3f(loc.getX(), loc.getY(), loc.getZ()),0.5f,0.5f,0.5f);
Geometry geom = new Geometry(current.get3DLocation().toString(), b); // create cube geometry from the shape
Material mat = new Material(getAssetManager(),
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
//mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
// set the cube's material
mat.setTexture("ColorMap", current.getTexture());

if (current.isTransparent){
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
}
geom.setMaterial(mat);
geom.addControl(new RigidBodyControl(0.0f));
getRootNode().attachChild(geom);

}[/java]

That's how I render blocks

Hmm, you shouldn’t. http://hub.jmonkeyengine.org/groups/general-2/forum/topic/minecraft-block-generating/

I heard you could reduce lag with culling? How does this work, and what is “culling”?

Are you meaning Frustum Culling? Yes.



This link says more then a thousand of words.



How do i get culling to work with individual textures?

and about culling : https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math?s[]=jme3&s[]=culling#visibility_determination

tbraun96 said:
How do i get culling to work with individual textures?


What culling have to do with textures? just use small textures to get a good performance.

How to i enable culling to the root pane?

Do not worry about culling. JME is already doing frustum culling for you. That is the least of your worries at this early stage in your learning process.

Thank you so much for helping me :). Now, how do i create a first person charcter + camera?

The camera is already “first person” so I don’t know what you mean.

Hmm… I want it so my “character” can only walk on where there are nodes below it. Like it can only walk on surfaces. I want to change it so the camera is more minecraft-like.

Well, whatever you would get working now would only need to change once you get everything else working. Get your world rendered correctly before you worry about colliding with it.



As a beginner, you have your work cut out for you. While a block world is relatively easy to throw together for a seasoned 3D programmer, it will present many challenges for you as you learn your way. Try to take one bite at a time.



Alternately, you could jump ahead to some of the other block engines folks have started… linked in the above linked post:

http://hub.jmonkeyengine.org/forums/?fs=voxel