Thx 4 your help, and sorry for late reply, been pretty busy.
Tried out your really smart idea (I wouldn’t have figured that out by myself) but now see what happens (sorry for poor quality):
http://www.youtube.com/watch?v=dLP1gAEYx0I
The sphere collides and sometimes jumps back. Everything fine so far.
But than it suddenly ignores the collision and walks through the wall again.
import ...
public class labyrinth extends SimpleGame {
private ...
public static void main(String args[]) {
labyrinth game = new labyrinth();
game.start();
}
protected void simpleInitGame() {
camNode();
}
//***************Usually the Map-Import stands here ********//
private void camNode() {
cam = display.getRenderer().getCamera();
cam.setFrustum(1.0f, 1000.0f, -0.55f, 0.55f, 0.4125f, -0.4125f);
camNode = new CameraNode("Camera Node", cam);
camNode.setLocalTranslation(new Vector3f(230, 25, -220));
camNode.lookAt(new Vector3f(200, 25, 200), new Vector3f(0, 1, 0));
camNode.updateWorldData(0);
rootNode.attachChild(camNode);
cam.update();
Sphere camSphere=new Sphere("Camera Sphere",10,10,1f);
camSphere.setModelBound(new BoundingBox());
camSphere.setLocalScale(2.0f);
camSphere.setLocalTranslation(new Vector3f(0, 3, 20));
camSphere.updateModelBound();
sphereNode = new Node("Sphere Node");
sphereNode.attachChild(camSphere);
camNode.attachChild(sphereNode);
input.addAction(new KeyNodeForwardAction( camNode, 50 ), "forward", true);
input.addAction(new KeyNodeBackwardAction( camNode, 50 ), "backward", true);
KeyNodeRotateRightAction rotateRight = new KeyNodeRotateRightAction( camNode, 1.5f );
rotateRight.setLockAxis( camNode.getLocalRotation().getRotationColumn( 1 ) );
input.addAction( rotateRight, "strafeRight", true );
KeyNodeRotateLeftAction rotateLeft = new KeyNodeRotateLeftAction( camNode, 1.5f );
rotateLeft.setLockAxis( camNode.getLocalRotation().getRotationColumn( 1 ) );
input.addAction( rotateLeft, "strafeLeft", true );
input = new NodeHandler( camNode, 60, 0.475f );
NodeMouseLook MouseLook = new NodeMouseLook(mouse, camNode, 5);
MouseLook.setLockAxis(new Vector3f(cam.getUp().x, cam.getUp().y, cam.getUp().z));
input.update(1);
}
@Override
protected void simpleUpdate() {
LocX = camNode.getLocalTranslation().getX();
LocY = camNode.getLocalTranslation().getY();
LocZ = camNode.getLocalTranslation().getZ();
if(prevX != Float.POSITIVE_INFINITY) {
changeX = camNode.getLocalTranslation().x-prevX;
}
prevX = camNode.getLocalTranslation().getX();
if(prevZ != Float.POSITIVE_INFINITY) {
changeZ = camNode.getLocalTranslation().z-prevZ;
}
prevZ = camNode.getLocalTranslation().getZ();
if (camNode.hasCollision(scene, false)){
if (changeX > 0 ){
LocXnew = LocX * .95f;
LocYnew = LocY;
LocZnew = LocZ * .95f;
camNode.setLocalTranslation(LocXnew, LocYnew, LocZnew);
}
else if (changeX < 0)
{
LocXnew = LocX * 1.05f;
LocYnew = LocY;
LocZnew = LocZ * 1.05f;
camNode.setLocalTranslation(LocXnew, LocYnew, LocZnew);
if (changeZ > 0 ){
LocXnew = LocX * .95f;
LocYnew = LocY;
LocZnew = LocZ * .95f;
camNode.setLocalTranslation(LocXnew, LocYnew, LocZnew);
}
else if (changeZ < 0)
{
LocXnew = LocX * 1.05f;
LocYnew = LocY;
LocZnew = LocZ * 1.05f;
camNode.setLocalTranslation(LocXnew, LocYnew, LocZnew);
}
}
}
}
}
}
I'm quite stumped