Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClippedCamera can push through geometry, "margin" does nothing? #36049

Closed
binaryorange opened this issue Feb 9, 2020 · 12 comments
Closed

ClippedCamera can push through geometry, "margin" does nothing? #36049

binaryorange opened this issue Feb 9, 2020 · 12 comments

Comments

@binaryorange
Copy link

Godot Version
3.2 Stable

OS/device including version:
Windows 10

Issue description:
ClippedCamera seems to be able to be "pushed" through geometry in certain instances, and will catch the "edge" of objects and show glitchy glimpses of the background behind the objects while appearing to still be clipping to that object.

It would appear that the "margin" property also seems to do nothing, as it has no visible effect on the distance the camera can clip to geometry.

Steps to reproduce:

  • Create basic test scene with moveable player
  • Set up ClippedCamera node behind the player
  • Move the camera into geometry and try to catch edges
@KoBeWi
Copy link
Member

KoBeWi commented Feb 21, 2020

Reproduction project would be useful.

@Paavs-Git
Copy link

I've created a MRP for this issue with 3.2.3-stable (also present in master with ClippedCamera3D):
clipped_camera_issue_MRP.zip

Steps to reproduce:
Move the mouse around to collide with the geometry.

It has a collision-enabled CSG and a BoxShape'd StaticBody as examples for collision. Indeed the 'margin' property of the ClippedCamera seems to do nothing. The 'near' property of the camera doesn't help to alleviate the problem either unless a large and unfeasible value is used.
Worth also pointing out the issue can be seen more severely when the camera collides at different angles (in the MRP by changing the pivot's translation to different heights) but I didn't think it was worth adding controller logic since it's clearly visible as is.

Gif:
clipped_camera_gif

@jkulawik
Copy link

jkulawik commented Nov 4, 2020

I'm having this issue too. For me it clips through all geometry specified by the chosen layer.

I've been animating the camera with AnimationPlayer by changing the rotation of a parent node. Setting the margin to something even ridiculously high doesn't do anything.

I tried attaching the camera directly to the KinematicBody I use as the player. It was only moved with move_and_slide in this test. The camera still clips through everything despite changing the margin setting.

Godot version: 3.2.2.stable.
OS: Windows 7

@ComputerASCII
Copy link

ComputerASCII commented Apr 27, 2021

This is still a problem with version 3.3 stable. The more accurate the collision testing is (e.g. Trimesh Collision), the more likely it is to "push through" the geometry. Inaccurate collision testing (e.g. Single Convex Collision) rarely pushes through, and only with certain angular geometries. An SCC cylinder does not get pushed through, but an SCC convex polygon does at certain angles. Both are pushed through with TC.

@Calinou
Copy link
Member

Calinou commented Apr 27, 2021

As a workaround, using a SpringArm + Camera3D setup may work more reliably.

@jkulawik
Copy link

jkulawik commented Apr 27, 2021

As a workaround, using a SpringArm + Camera3D setup may work more reliably.

I have, and the results sadly are flimsy and inelegant compared to the simplicity of just having a camera that doesn't allow clipping

@ComputerASCII
Copy link

ComputerASCII commented Apr 28, 2021

To elaborate, the Clipped Camera only "pushes through" geometry for me when it's off-center from the Kinematic Body it's a child of. So, to any future readers wondering how to fix the problem, try centering your Clipped Camera on your Kinematic body (which admittedly it does by default lol). This works for 1st and 3rd person cameras alike.

As for making it work off-center from your Kinematic Body, I have no idea. If you have an off-center 1st-person camera on a Kinematic Body that can change its angle of orientation (clipped or normal camera), it will almost certainly clip with geometry. Having it centered will give you a camera view at the Kinematic Body's proverbial belly button height; It works, but it's not ideal.

Please note that I'm also a total newb at Godot, and might be speaking from a place of ignorance. So take what I say with a grain of salt, but don't be afraid to try the method that worked for me!

@anti-matt-er
Copy link

For me, changing "Process Mode" to Idle instead of the default Physics completely fixed this issue. I suspect this depends on whether your camera script runs in _process or _physics_process, but it seems in my case that Idle mode is the only one that works regardless of this. It's worth a try, anyway.

@KoBeWi
Copy link
Member

KoBeWi commented Dec 9, 2021

ClippedCamera was removed in 4.0

@KoBeWi KoBeWi closed this as completed Dec 9, 2021
@KoBeWi KoBeWi added this to the 4.0 milestone Dec 9, 2021
@Calinou
Copy link
Member

Calinou commented Dec 9, 2021

For rationale on why ClippedCamera was removed, see #53354. See also godotengine/godot-proposals#2560.

@LevitatingRobot
Copy link

LevitatingRobot commented Jun 25, 2024

From what I can tell, this is still and issue, and hasnt been fixed yet, just with the normal Camera3D node.

@Zireael07
Copy link
Contributor

Normal Camera3D node has no built in protections against clipping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants