https://twitter.com/SuccubiinHats/status/892629420447592449
I made a camera for use in 3D games that eliminates pixel swimming. It allows your mesh to render like sprites and the background to stay static as you move the camera around. The camera can also be used topdown, isometric or from the side as long as there is no Roll on the camera itself.
To use:
- Place the camera in your world and orient for your needs.
- Implement PixelSnappableInterface on all your pawns.
- Pawns should decouple their mesh from the collision and return the mesh through the interface. The camera will adjust the mesh to snap to the pixels.
To reimplement this in other programs, all you need to do is create an orthographic camera and transform the locations of your dynamic meshes with the inverse transformation matrix of the camera, then snap XYZ in camera local space to [Camera Orthographic View Width]/[resolution] increments and finally transform back into world space with the camera's transformation matrix. The camera's location also needs to be snapped the same way as your meshes.
Note: The current follow implementation is not very good and causes some jittering. This camera works best when moved by the player or on it's own.