Jump to content

camera zoom


Fabioxps

Recommended Posts

how to put zoom on the camera, and stop at a target

function StartCamera() 
local z = 100 
setCameraMatrix(0,0,z,-1056.7127685547, 1042.8658447266, 38.503734588623)  
setTimer(function() 
z = z - 1 
setCameraMatrix(0,0,z,-1056.7127685547, 1032.8658447266, 38.503734588623) 
end,1000,100) 
end 
addEventHandler("onClientRender", root, StartCamera) 

Link to comment

Your code is spamming the setTimer over and over and over and will never finish the loop. Let the best kid in town solve this problemo for you.

Since it is a client sided code, it would be ok to use setTimer:

function startZoom() 
    z = 100 
    setCameraMatrix(0,0,z,-1056.7127685547, 1042.8658447266, 38.503734588623) 
    setTimer(function() z = z - 1 setCameraMatrix(0,0,z,-1056.7127685547, 1032.8658447266, 38.503734588623) end, 50, 95) 
end 
  
addCommandHandler('zoom', startZoom) 

Couldn't fully decipher what you needed, so is this what you wanted? If this is what you wanted, just add startZoom() to wherever in your code you want it to begin, also you might want to remove the command handler.

Link to comment
function startZoom() 
    z = 100 
    setCameraMatrix(0,0,z,-1056.7127685547, 1042.8658447266, 38.503734588623) 
    setTimer(function() z = z - 1 setCameraMatrix(0,0,z,-1056.7127685547, 1032.8658447266, 38.503734588623) end, 50, 95) 
end 
addEventHandler("onClientRender", getRootElement(), startZoom) 

what do this wrong?

Link to comment
function startZoom() 
    z = 100 
    setCameraMatrix(0,0,z,-1056.7127685547, 1042.8658447266, 38.503734588623) 
    setTimer(function() z = z - 1 setCameraMatrix(0,0,z,-1056.7127685547, 1032.8658447266, 38.503734588623) end, 50, 95) 
end 
addEventHandler("onClientRender", getRootElement(), startZoom) 

what do this wrong?

That does not make sense

Link to comment

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...