www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: tollos on December 12, 2012, 03:52:43 pm

Title: Camera and texture problem
Post by: tollos 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 !

(http://i46.tinypic.com/20ue9ll.png)
(http://i50.tinypic.com/24mfdi0.png)

Title: Re: Camera and texture problem
Post by: EgonOlsen on December 12, 2012, 07:55:21 pm
The most simple way is to increase the ellipsoid's size.
Title: Re: Camera and texture problem
Post by: tollos 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.

Title: Re: Camera and texture problem
Post by: EgonOlsen 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.