Previous --- Next

Index

Perspectivate!

One problem that I have run into on this, and other projects is that of perspective warping on first-person view models.

While not immediately apparent in the above screenshot, the perspective does seem somewhat exaggerated when in motion, and especially with an increased field of view as I intend to have in order to increase the "epicness" of the game:

In order to correct this I scaled down the entire rig and model along the Z axis, toward the camera and the resulting first person viewmodel is this:

As the rig shared it's root node with the camera, scaling the model in this manner allowed the effect of perspective on the viewmodel to be tuned independently of the camera's FoV without any negative side effects.


Another issue with the viewmodel was that it would pass through other objects in the world:

Again, the problem was solved with scaling, as I realised the viewmodel does not need to be to scale with the rest of the scene, only appear the right size to the player.

Then it was a matter of scaling down the viewmodel until it was within the collision bounds for the character controller, as seen here with the scaling for the perspective correction too (yellow capsule represents the character collider):

Standing in the same position, the resulting view is this (Note: the field of view differs):

One other minor issue with the camera was that when the camera rotated about it's X-Axis (up and down) it did so from the centre of the character controller, rather than the camera itself.  The effect of this was that it appeared as though you were leaning forward when looking down, and leaning up when looking up.

One effect of this problem was being able to lean into objects in the scene as shown here:

This was solved by modifying the MouseLook script to rotate the Y-Axis of the character controller (necessary to control the rotation of the character) and the X-Axis of the camera. Providing the camera is centred on the character controller, this works out great.
Standing in the same position produces this result:

Another unexpected benefit of this fix is that it makes it a lot easier to judge where your characters feet are when looking at where you're running and jumping to. Given the platforming aspects this is mightily useful.

Previous --- Next

Index