Why can players peek into the Void

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Why can players peek into the Void

Post by pango »

I've been wondering why players can sometimes see thru ceilings into the Void, and noticed something:
If, inside the editor, you look at player's model, or at player under normal conditions, you can check that the camera and the part of the near clip plane that's within field of view and both nicely inside the character controller capsule:
player model.jpg
player model.jpg (30.84 KiB) Viewed 5038 times
However, when you can peek inside the Void, the camera gets outside of the capsule:
player camera.jpg
player camera.jpg (71.24 KiB) Viewed 5038 times
That puzzled me for a moment, and my hypothesis is that the culprit is the head dipping mechanism, that shortens the character controller capsule, but neither the smooth follower nor the camera that's attached to it are adjusted for that change.
(I noticed that the head dipping itself depends on camera position, so fixing the issue may be more involved than expected...)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Why can players peek into the Void

Post by Interkarma »

This used to happen with crouch as well.

I didn't think of this case with head-dipping, which was only meant to be a momentary thing when crossing through certain low doorways. There's also an unsatisfying "bounce" if you can position head-dip right in the sweet spot.

I'm not so worried about this case, but it would be nice to polish out later if it doesn't create problems elsewhere.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Why can players peek into the Void

Post by pango »

Okay, trying to debug this issue, I noticed I did not understand correctly how head dipping works...
The two raycasts that are used are horizontal and have exactly the same reach, so when approaching a vertical wall they should hit exactly at the same moment and not trigger head dipping.
Back to the original observation, that means the camera can escape the player capsule, most likely for another, unexplained, reason...

(P.S. as a micro-optimization, eye raycast could be done only when head raycast hits)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply