Author Topic: Camera and texture problem  (Read 1919 times)

Offline tollos

  • byte
  • *
  • Posts: 13
    • View Profile
Camera and texture problem
« on: December 12, 2012, 03:52:43 pm »
Hello there,

I'm currenly porting one of my old games in 3D and I'm reaching a small problem with cameras and textures.
It's a 3rd person game so the camera follows the hero.

I put a simple mechanism using checkCollisionElipsoid with a rotation on X axis to look a bit up/down :
Code: [Select]
                    // perso.sprite.getMain() returns the head which is the parent object of the character

                    cam.setPositionToCenter(perso.sprite.getMain());
            cam.align(perso.sprite.getMain());           
            cam.rotateX(totalRotationX);

           
            world.checkCameraCollisionEllipsoid(Camera.CAMERA_MOVEOUT, ellipsoidCam, 10, 8);
            world.checkCameraCollisionEllipsoid(Camera.CAMERA_MOVEUP, ellipsoidCam, 1, 5);

It's working fine for outdoor levels but while rendering an indoor level, I have a lot of time the camera going "out of the wall" and I can see behind the texture like in the second screenshot.
The first screen shot is when the camera is normal, the second is when the character is close to a wall and I rotate the camera to the right.

Is there a way to avoid that ?

Thanks in advance !





Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Camera and texture problem
« Reply #1 on: December 12, 2012, 07:55:21 pm »
The most simple way is to increase the ellipsoid's size.

Offline tollos

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Camera and texture problem
« Reply #2 on: December 13, 2012, 04:54:13 pm »
Yes but it's only working in big rooms, if I put it with a big ellipsoid on corridors the camera is moving in a not nice way.

I found a workaround ... I put setCulling(false) to the level when i'm indoor, it's not fixing the problem but at least the players cannot peak trough a wall to see the end of the level.


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Camera and texture problem
« Reply #3 on: December 13, 2012, 09:32:03 pm »
Well, do whatever works for you. It's a common problem and it can only be solved by adjusting the camera in a way that the issue isn't visible.