The solution I found was to update the up vector every frame, and change it based on what direction the camera's looking. Otherwise it will just tilt in the same direction and not respect in what direction you're looking, which will feel like the world is tilted and not the camera.Jasoco wrote: ↑Tue Apr 05, 2022 10:00 pmInteresting but it seems to rotate the world itself instead of just the camera. In other words, if I'm looking forward and I change say the Y value, it'll look right until I turn my head at which point I realize it's changing the world itself instead of just rolling the camera.groverburger wrote: ↑Mon Apr 04, 2022 6:57 pm Yep, the easiest way to achieve this is to change the camera's up vector, and make it point up and slightly to whatever direction you want to tilt.
Something like:Code: Select all
g3d.camera.up = {some vector here} g3d.camera.updateViewMatrix()
I tried to just use Löve's translation stuff like push, rotate, translate, pop to just rotate the image itself but of course since g3d is all shader based it just ignores all that. lol
Here's an example of what I would put in my update function:
Code: Select all
local direction, pitch = g3d.camera.getDirectionPitch()
local tilt = 0.05
local tiltDirection = direction + math.pi/2
g3d.camera.up = {math.cos(tiltDirection)*tilt*math.cos(pitch), math.sin(tiltDirection)*tilt*math.cos(pitch), 1}
g3d.camera.updateViewMatrix()