Hi
I can't apply any of the collision detection methods.
I have 3 Objects:
//a floor
terrain = Primitives.getPlane(30, 60);
terrain.setTexture("rocks");
terrain.rotateX((float)Math.toRadians(90));
//wall
wall = Primitives.getBox(10, 15);
wall.translate(-400,0,0);
wall.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS|Object3D.COLLISION_CHECK_SELF);
wall.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
//player
public Player(){
super(Primitives.getSphere(30));
this.translate(0, -30, 0);
this.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS | Object3D.COLLISION_CHECK_SELF);
this.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
}
public void moveForward(){
int objID=checkForCollision(getZAxis(), getSpeed());
if (objID==Object3D.NO_OBJECT) {
super.moveForward();
}
}
I move the player(ball) as in the car example. I want to perform a collision check against the wall. What am I missing?
Edit:
It actually works, but when the wall is a plane and not a box. Why can't I apply this method to a box?
Try to increase this value: http://www.jpct.net/doc/com/threed/jpct/Config.html#collideOffset (http://www.jpct.net/doc/com/threed/jpct/Config.html#collideOffset)
That solved my problem. Thank You.