Change rotation in render script (SOLVED)

How do you rotate the intire render, make the whole screen rotate?

Right now I have found out that if you modify the self.view you can get some intresting results,

local a = os.clock()
local cos = math.cos(a)
local sin = math.sin(a)

self.view = vmath.matrix4_look_at(

vmath.vector3(1,0,0), 
vmath.vector3(0,cos,-sin), 
vmath.vector3(0, sin, cos)

)

but I want to rotate it on the Z axis and I don’t really know how to do it.

Yes, the view matrix is the transform of the camera. vmath.matrix4_rotation_z should do what you want. (though I haven’t tried it)

It’s generally easier to use a camera object and let it send the view and projection matrices automatically.

3 Likes

Works, Thanks!

1 Like