Author Topic: Two little questions  (Read 2846 times)


  • Guest
Two little questions
« on: July 15, 2004, 12:15:59 pm »
Hi Egon,

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

Code: [Select]

boolean cameraChanged=false;
if (forward) {
    camera.moveCamera(new SimpleVector(0,1,0), PLAYER_HEIGHT/2f);
    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
Code: [Select]
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 :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12015
    • View Profile
Two little questions
« Reply #1 on: July 15, 2004, 08:24:08 pm »
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 ( and see if it helps. You have to do this before instantiating your world.

Hope this helps.

Offline Tornado7

  • byte
  • *
  • Posts: 45
    • View Profile
Two little questions
« Reply #2 on: July 16, 2004, 12:06:16 pm »
Ok, now it works  :D

Bye and thanks a lot for your help :wink: