Need help and/or suggestions with clipping things from a third person camera view

Hello. I am tinkering with Panda3d still and have set up a third-person sort of game. The main issue is that a lot of the rooms in the level/model are fairly small. So when I turn my character, I get a lot of unwanted parts that block the camera (mostly walls).

I have implemented set_near() and it does solve the problem to some degree. But unfortunately little “pieces” of models/wall are still visible and obstruct the camera view. Incrementing the value passed to set_near() does gradually make the problem go away, but it also introduces some undesirable effects (objects off to the side of the camera look like they are “melting” in and/or out of view as the character moves).

I then implemented my own clipping plane that would cut the southern facing wall out of view (in relation to the Actor). This worked but had a few spots where the camera was still slightly blocked by various parts of the scene.

How to make a third person camera that looks professional? I am almost considering adding collision to the camera, and possibly moving it upwards while tilting it downwards when the Actor is near a wall. I really don’t know though. Any suggestions?

Facing wall looks good:

Once turned there are still some pieces of the model that obscure the view:

Facing the wall/couch looks good:

But turning again results in some little pieces that look almost like a grid (part of the room model):

I don’t play that many games with this sort of “close-range third-person” view, but I see two options offhand:

  1. As you say, implement some form of collision detection and use it to keep the camera in a more-or-less valid position.
  2. Make your walls double-sided and use a shader to erase the relevant parts of walls that are in the way.

You can see a simple implementation of the former in my “Simple Third-Person Camera” controller, if I recall correctly:

1 Like

Thanks… well maybe I’ll give the collision detection on the camera a try then. I didn’t run your code yet, but I am curious as to where you move the camera? I kinda want something like this: How To Stop Camera Clipping Through Walls /Objects - Unreal Engine 4 Tutorial - YouTube (but with Panda3d of course).

I believe that I’m doing it in the “update” method of “” (starting with the comment that reads “# Determine where it should be:”), although the actual collision elements are implemented in “”.

Thanks I may try something similar… will post back here at some point

1 Like

There is a third option - to use a stationary camera in the style of video surveillance. In this case, you need to create zones for switching camera views. This has been used in games like “Silent Hill” and the like.

1 Like

@Thaumaturge I haven’t had a chance to try anything yet… had too much work programming yuck. I just followed you on Git though. I am rootVIII.

I think my implementation will be different than yours, but I may use yours for inspiration I think. I’ll make the example project public once I figure it out… it’s just one room that I found for free online haha. But I have a model with many rooms that I will eventually implement.

1 Like

Okay I have something going that does a gradual but quick camera zoom on collision, so just the y value of the camera is changed. I am relying on cardinal directions a bit for that though which I do not like. GitHub - rootVIII/panda3d_room: Example Panda3d scene with 3rd-person camera

EDIT: actually it needs some more work… sometimes it gets tricked into zooming when it shouldn’t

EDIT 2: Okay I think I got it… still relying heavily on cardinal directions though… may try a raycast solution possibly. As of now I get the difference between two points (the main Actor and Wall X) to find the nearest wall and then look at the heading of the actor.