I had this problem too with a small object I am putting together with addTriangle. I just couldn't get the collision detection to work, so I tried a plane too. That didn't work either, until I flipped the plane over.
Results in: collisionObject == Object3D.NO_OBJECT
but if I rotate the plane the opposite way:
it works. However, the texture does not display, it is on the side of the plane away from the camera.
:?: Just curious, why does flipping the plane over the other way fix this? Normals, aabbs, or something else?
Thanks,
Jim
Code Select
Object3D aPlane = Primitives.getPlane(4, 5);
aPlane.rotateAxis(aPlane.getXAxis(), (float)Math.PI/2);
aPlane.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
aPlane.setTexture("wood");
aPlane.build();
theWorld.addObject(aPlane);
SimpleVector cameraPosition;
cameraPosition = aPlane.getCenter();
cameraPosition.y = cameraPosition.y - 40;
cameraPosition.z = cameraPosition.z - 65;
camera.setPosition(cameraPosition);
camera.lookAt(aPlane.getCenter());
...
SimpleVector testMove = someObject.getTransformedCenter();
SimpleVector dir = new SimpleVector(0, -5, 0);
int collisionObject = theWorld.checkCollision(testMove, dir, 10);
Camera camera = theWorld.getCamera();
Results in: collisionObject == Object3D.NO_OBJECT
but if I rotate the plane the opposite way:
Code Select
aPlane.rotateAxis(aPlane.getXAxis(), -(float)Math.PI/2);
it works. However, the texture does not display, it is on the side of the plane away from the camera.
:?: Just curious, why does flipping the plane over the other way fix this? Normals, aabbs, or something else?
Thanks,
Jim