Jump to content

Camera stuff..


Recommended Posts

Posted

Is there any way to slowly move a camera using set camera matrix, or some similar function. Trying to make a camera slowly move around the map behind login screen, but cannot figure out how I'd do this without having to define a hundred points in a table that it slowly loops about.

Wolf Inc Discord

Youtube channel
Github

Posted

Here, use this:

local frame = 0 
local goingRight = true 
local goingLeft = false 
function rotateCamera( ) 
     
    if frame <= 400 and goingRight then 
         
        local a, b, c, d, e, f = getCameraMatrix() 
        setCameraMatrix(a, b, c, d + 0.2, e + 0.2, f) 
     
    elseif frame <= 200 and goingLeft then 
         
        local a, b, c, d, e, f = getCameraMatrix() 
        setCameraMatrix(a, b, c, d - 0.2, e - 0.2, f) 
    end  
     
    frame = frame + 1 
    if frame == 400 and goingRight then 
             
        goingRight = false 
        goingLeft = true 
        frame = -400 
    elseif frame == 200 and goingLeft then 
             
        goingRight = true 
        goingLeft = false 
        frame = -200 
    end 
end 

And add this in the function where you render your login panel:

addEventHandler("onClientRender", getRootElement(), rotateCamera) 

Don't forget to use removeEventHandler when you remove your login panel.

76561198066470453.png

SP37Ecj.jpg?2MTA:Rust Pre-Alpha Build v.0.3:SP37Ecj.jpg?2

https://forum.mtasa.com/viewtopic.php?f=114&t=97848

2Pac: ''Only God can judge me!''

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...