1
\$\begingroup\$

How to prevent the Camera from Clipping/Hiding part of the 3D Model/Object?

I tried playing around with Near/Far properties , but it doesn't change the result.

EDIT: it happens when the Camera follow the player : https://youtu.be/ewi-TzI3204

I'm moving the CameraRig which the Camera is child of it:

void MainCamera::_process(float delta)
{
    auto pos = hero->get_translation();
    pos.y = 0;
    camera_rig->set_translation(pos);
}

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Have you tried moving the camera further away from the scene? \$\endgroup\$
    – DMGregory
    May 31 '21 at 15:26
  • \$\begingroup\$ I tried moving it, but when the camera follow the player , that happens \$\endgroup\$
    – Abanoub
    May 31 '21 at 15:36
1
\$\begingroup\$

Move the Camera away.

I'm not suggesting to move the CameraRig, as the CameraRig is moved by code. Instead change the (local) transform of the Camera. Which is relative to its its parent (i.e. the CameraRig).

Even though the Camera is using an orthogonal projection. It still has a position in the world, and things behind the Camera get clipped. Remember that the near plane is always in front of the Camera.

Thus, pull the Camera away. Position it distant enough that everything that should be visible is visible.

That, of course, is no way around objects getting close to the Camera anyway. You can try setting objects materials with "Distance Fade" to handle that.

\$\endgroup\$
4
  • \$\begingroup\$ pulling the camera away, and moving it around will work at the beginning , but once the player move and the camera follows , this clipping happens \$\endgroup\$
    – Abanoub
    May 31 '21 at 15:37
  • 1
    \$\begingroup\$ @Abanoub Are you moving the Camera or are you moving the CameraRig? Have the CameraRig follow the player, and then the Camera being a child of the CameraRig can have a transform relative to it. \$\endgroup\$
    – Theraot
    May 31 '21 at 15:42
  • \$\begingroup\$ I'm doing exactly that , I have updated the question \$\endgroup\$
    – Abanoub
    May 31 '21 at 15:49
  • \$\begingroup\$ @Abanoub I have to reiterate, move the Camera. I can see both in the image in the question and the linked video that the Camera has a transform of 4 on the y and 5 on the z... That is not changing as the player moves around. If you change that transform, it will not be undone when the player moves. Move the Camera further away. \$\endgroup\$
    – Theraot
    May 31 '21 at 15:52
0
\$\begingroup\$

well, silly me , I didn't see the Camera port of view is going through the floor, which was the reason it was clipping:

enter image description here

moving the Camera up , fixed the issue :

enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .