# Moving a Box and Collision problem

Hello everybody,

I’m new here and it’s my first topic in this forum, here is my problem:

In my game, the main Character is a Box, i want it to move (with arrow Keys) Up, Down, Left, and Right, here is my code :

[java]

Box b=new Box(Vector3f.ZERO, 0.6f, 0.6f, 0.6f);

geom1 = new Geometry(“Box”, b);

geom1.updateModelBound();

Material matp = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material

matp.setColor(“Color”, ColorRGBA.Red); // set color of material to blue

geom1.setMaterial(matp); // set the cube’s material

SphereCollisionShape playerShape = new SphereCollisionShape(0.6f);

player = new CharacterControl(playerShape, 0.01f);

player.setJumpSpeed(5);

player.setFallSpeed(30);

player.setGravity(30);

player.setPhysicsLocation(new Vector3f(0, 15f, 1f));

rootNode.attachChild(geom1);

public void simpleUpdate(float tpf) {

Vector3f v = geom1.getLocalTranslation();

if (left) { v.x -= 0.05f; }

if (right) { v.x += 0.05f; }

if (up) { v.z -= 0.05f;}

if (down) { v.z += 0.05f;}

player.setPhysicsLocation(v); // Where i move my player

}

[/java]

I tested player.setWalkDirection(v); but the box moves with jumping and i don’t want that. And when i do player.setPhysicsLocation(v); the player don’t detect the collisions with the other shapes.

My question : How can i move my Box correctly (without jumping) and detect collisions?

Thank you for your answers and excuse my wrinting, English is not my native language.

PS : JME Roxx

while using CharacterControl u should only use

player.setWalkDirection(Vector3f direction)

for walking

i refrence u for the tutiral Hello Collision

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_collision