Camera and texture problem

Started by tollos, December 12, 2012, 03:52:43 PM

Previous topic - Next topic

tollos

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 :

                    // 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 !





EgonOlsen

The most simple way is to increase the ellipsoid's size.

tollos

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.


EgonOlsen

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.