0 votes

Currently I'm trying to set up a third person camera, which I've done by having a Spatial node in the middle of my character and a Camera as a child with a script that rotates the Spatial node with mouse movements. Currently however the camera keeps clipping through objects and walls, which I don't want. Apparently ClippedCamera is what I'm supposed to use for this, but it doesn't really seem to work. When walking against a wall it collides with it a bit but then when walking too far the camera ends up going through the wall anyway. How am I supposed to solve this?

This is what the clipped camera looks like in the viewport
ClippedCamera Position

This is what the tree looks like
Tree

And this is what the properties of the Clipped Camera look like
Properties
I've also tried setting the margin to its maximum but that didn't help either.

Does anyone know how to stop the camera from clipping?

asked Jul 7 in Engine by AmaraAngel (12 points)

I'm inclined to think that the camera goes through the wall because when you rotate its parent, you are indirectly setting its position to be at some distance from the character. When you get too close to a wall, that distance is large enough for the camera to be PLACED beyond the wall, and it ends up thinking that it has no constraining to do. It doesn't seem know what point in space it is looking at either, there isn't even a distance parameter on that node (which is also not documented). Or maybe it's a bug?
Although, I could be wrong, I never used that node, I don't know how it is supposed to be used. So far I did this system by raycasting from the character directly rather than having parent/child.
You could post your problem on Github because to me it's either a bug or a documentation problem.

Edit: ok that camera takes its parent's global position as target point so your setup should be correct... still not sure where it gets its regular distance from. Is it margin? Maybe you should increase it or something?

I've already tried setting margin but it doesn't really seem to do much, if not anything. I've tried having a raycast from the character but I had a bit of trouble with that. I guess I'll have to try that again.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.