# I pass throught the physical ground!

Hello guys, for train my, I devellop a cubic game like minecraft, so all are right, but when I walk a little I pass trought the cube, as they are physic it is strange !

I have write the in game part on a AppState.

edit : problem solved, I have modified the dir.y and camLeft.y value to 0.5f

[java]public void update(float tpf)

{

Vector3f dir = cam.getDirection().mult(0.15f);

Vector3f camLeft = cam.getLeft().clone().multLocal(0.1f);

dir.y = 0.5f;

camLeft.y = 0.5f;

walkDirection.set(0, 0, 0);

if (left)

{

}

if (right)

{

}

if (up)

{

}

if (down)

{

}

player.setWalkDirection(walkDirection);

cam.setLocation(player.getPhysicsLocation());

}[/java]

For create the terrain I use a method makeCube(Vector3f position, int typeOfCube)

[java]public void makeCube(Vector3f position, int typeOfCube)

{

//Create a cube Geometry and attach it to the scene graph

Geometry cube = new Geometry(âcubeNumberâ + numberOfModel, box);

RigidBodyControl rbc = new RigidBodyControl(boxShape, 0);

if(typeOfCube == 1)

{

cube.setMaterial(grass);

}

else if(typeOfCube == 2)

{

cube.setMaterial(beton);

}

rootNode.attachChild(cube);

rbc.setPhysicsLocation(position);//set physical location

numberOfModel++;

}[/java]

My player is physical too, I init his physic on the initPhysic() method :

[java]public void initPhysic()

{

CapsuleCollisionShape capsule = new CapsuleCollisionShape(0.5f, 2f, 1);

player = new CharacterControl(capsule, 1f);

player.setJumpSpeed(10);

player.setFallSpeed(30);

player.setGravity(40);

player.setPhysicsLocation(new Vector3f(5, 10, 5));

}[/java]

In images with debug mode (sorry if images are too big) :

normal comportment

When I pass trought the pysical ground :

Have you an idea, of the problem ?

For box worlds donât use cubes! Look at custom meshes and voxels

1 Like

ok, I know now for what the game lag ^^

tank

sorry If I am stupid, but have you a documentation for voxel ?

because I have try too read the boxel engineâs source, but I donât understand anything

There is plenty of information on the forums, you are not the first one to ask about voxel engines. just use the search. Really, the topic comes up nearly every week.

1 Like

sorry, I have search, and I have dowload the voxel devellopment kit, bloxel source, and bloxel engine source, but I donât know how to use of it,

I think I will try custom meshe, that is more easy than read the source code of a project ^^

Try reading about what a voxel engine is (big hint: A Box world is, in fact, NOT composed of boxes). Try to understand what a âvoxel worldâ really is. And then, how you can make it appear on the screen (hint: create custom mesh programatically from voxel data).

And maybe you go and search the forums again, as i said, there is plenty of information here. Not only some source code and some more or less ready-to-use voxel engines, but plenty of descriptions what a boc world really is and how to manage it.

I wouldnât have told you, that the information is there, if it werenât. The question comes nearly every week.

4 Likes

thank you I do that, sorry for disturbance