Two little questions

Started by Anonymous, July 15, 2004, 12:15:59 PM

Previous topic - Next topic

Anonymous

Hi Egon,

I'm analizing your fps's code and I'm not pretty sure to understand the meaning of the following:


boolean cameraChanged=false;
               
if (forward) {
               
   camera.moveCamera(new SimpleVector(0,1,0), PLAYER_HEIGHT/2f);
   cameraChanged=true;
   tempVector=playerDirection.getZAxis();
   theWorld.checkCameraCollisionEllipsoid(tempVector, ELLIPSOID_RADIUS, MOVE_SPEED, 4);
}

.
.
.

if (cameraChanged) {
   camera.moveCamera(new SimpleVector(0, -1, 0), PLAYER_HEIGHT/2f);
}



I don't understand why I've to reset the camera position, and why, if I comment
camera.moveCamera(new SimpleVector(0, -1, 0), PLAYER_HEIGHT/2f); and press the forward or backward button the camera goes in infinite under my floor....

The second question: as you know I'm using a configuration file that let me to load a certain number of feritos (wonded); I've noticed that when I load more than 4 of them in a particular camera position or rotation my world is completly black while the feritos are still visible; if I  move or rotate the camera a bit the world come back.... Considering that under four feritos this problem doesn't happen, it could be a memory problem?

Bye and thanks :)

EgonOlsen

The first call to moveCamera() moves the camera down into the middle of the virtual ellipsoid...or in other words: The ellipsoid collision detection for the camera takes the camera as the ellipsoid's center. But in this case, the ellipsoid is virtually below the camera (i.e. the player looks through his eyes, not his belly). To correct this, the camera is moved half way down, then collision detection is performed, then it's moved up again. If you remove the line you mentioned, the camera will be moved down and down and down...half the radius every frame and the ellipsoid collision detection can only avoid collisions but it can't push you out of existing ones reliable. That's the reason why you fall through the floor.
The other problem may be related to model complexity. The visibility list has a fixed size. Try to adjust this size (http://www.jpct.net/doc/com/threed/jpct/Config.html#maxPolysVisible) and see if it helps. You have to do this before instantiating your world.

Hope this helps.

Tornado7

Ok, now it works  :D

Bye and thanks a lot for your help :wink: