Turn off model clipping/disappearance on contact with CapsuleCollisionShape

Hi Forum,

I have set up a Node so that my gun model follows the player around, but part of the gun has disappeared or been “clipped” away, I’m guessing this is because it intersects with my player’s CapsuleCollisionShape.

I have a screenshot to show you what I mean:


There’s probably a method which can fix this, “spatial.setClipping(false)” or something, I’m sure.

Thanks in advance,


1 Like

I’m not an expert but to me it looks more like it’s coming over the camera frustrum. Try moving it a bit further forwards or tweaking the camera settings.

Thanks for the quick reply, but could you tell me what you’d do with the Frustum to solve this? I just tried moveing the Near and Far frustums and weird stuff happened :S

1 Like

Its nothing to do with your CapsuleCollisionShape

The default settings for the camera frustum are: a 45deg angle FOV, the cam aspect ratio (width/height) and near and far clipping planes of 1, and 1000.

Camera frustum looks like this:

Try this:

[java]cam.setFrustumPerspective(45f, (float)cam.getWidth()/cam.getHeight(), 0.0001f, 1000f);[/java]

1 Like

I wouldn’t recommend setting the near plane too close … you’re lowering your depth precision by quite a bit that way.

Instead you can render the gun in another viewport which has a different camera setup, this is how most FPS games do this anyway.

Not to mention that 0.0001 is like 1/10th of a millimeter away from the eye… if you are holding your gun that close to your eye then something is wrong. :slight_smile:

Yeah, I think you might just need to move the gun down and to the right a bit. At the moment you have it sticking out of your forehead…