Jump to content

Camera remove "start"


Fabioxps

Recommended Posts

Posted

all right but when you press f6 camera not back to the start why?

local visible = true 
  
setCameraMatrix (117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625) 
  
local progress = 0.0;  
function aa() 
    if progress < 1 then 
        progress = progress + 0.002; -- increase to move the camera faster 
    end 
    local x, y, z = interpolateBetween( 117.5101852417, 163.30557250977, 5579.2065429688, 120.94383239746,162.29713439941,5579.5678710938, progress, "Linear" ); 
    setCameraMatrix (x, y, z, 116.48139190674, 156.49519348145, 5579.0087890625) 
end 
addEventHandler("onClientRender",root, aa) 
  
  
bindKey("F6","down", 
    function() 
        if visible then 
            removeEventHandler("onClientRender",root, aa) 
            visible = false 
  
                     else  
            addEventHandler("onClientRender",root, aa) 
            visible = true 
        end     
end) 

Posted

Try this.

bindKey("F6","down", 
    function() 
        if visible == true then 
            removeEventHandler("onClientRender",root, aa) 
            setCameraMatrix (117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625) 
            visible = false 
        else 
            addEventHandler("onClientRender",root, aa) 
            visible = true 
        end     
end) 

Posted

You must return the camera to the local player using setCameraTarget.

local visible = true 
setCameraMatrix ( 117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625 ) 
local progress = 0.0; 
  
function aa ( ) 
    if ( progress < 1 ) then 
        progress = progress + 0.002; -- increase to move the camera faster 
    end 
    local x, y, z = interpolateBetween ( 117.5101852417, 163.30557250977, 5579.2065429688, 120.94383239746,162.29713439941,5579.5678710938, progress, "Linear" ); 
    setCameraMatrix ( x, y, z, 116.48139190674, 156.49519348145, 5579.0087890625 ) 
end 
addEventHandler ( "onClientRender", root, aa ) 
  
bindKey ( "F6", "down", 
    function ( ) 
        if ( visible ) then 
            removeEventHandler ( "onClientRender", root, aa ) 
            setCameraTarget ( localPlayer ) 
            visible = false 
        else 
            addEventHandler ( "onClientRender", root, aa ) 
            visible = true 
        end     
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
You must return the camera to the local player using setCameraTarget.
local visible = true 
setCameraMatrix ( 117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625 ) 
local progress = 0.0; 
  
function aa ( ) 
    if ( progress < 1 ) then 
        progress = progress + 0.002; -- increase to move the camera faster 
    end 
    local x, y, z = interpolateBetween ( 117.5101852417, 163.30557250977, 5579.2065429688, 120.94383239746,162.29713439941,5579.5678710938, progress, "Linear" ); 
    setCameraMatrix ( x, y, z, 116.48139190674, 156.49519348145, 5579.0087890625 ) 
end 
addEventHandler ( "onClientRender", root, aa ) 
  
bindKey ( "F6", "down", 
    function ( ) 
        if ( visible ) then 
            removeEventHandler ( "onClientRender", root, aa ) 
            setCameraTarget ( localPlayer ) 
            visible = false 
        else 
            addEventHandler ( "onClientRender", root, aa ) 
            visible = true 
        end     
    end 
) 

but the camera is not coming back to the beginning castilho

Posted

Beginning of what?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
You mean return to the initial position of the camera? That is the code I gave you.

the interpolateBetween only works when I start the resource in

Edited by Guest
Posted

Still not 100% sure what your asking but I assume it might be this.

bindKey("F6","down", 
    function() 
        if visible == true then 
            x, y, z = nil, nil, nil 
            progress = 0 
            setCameraMatrix (117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625) 
            visible = false 
             removeEventHandler("onClientRender",root, aa) 
        else 
            addEventHandler("onClientRender",root, aa) 
            visible = true 
        end     
end) 

Posted
Still not 100% sure what your asking but I assume it might be this.
bindKey("F6","down", 
    function() 
        if visible == true then 
            x, y, z = nil, nil, nil 
            progress = 0 
            setCameraMatrix (117.5101852417, 163.30557250977, 5579.2065429688, 116.48139190674, 156.49519348145, 5579.0087890625) 
            visible = false 
             removeEventHandler("onClientRender",root, aa) 
        else 
            addEventHandler("onClientRender",root, aa) 
            visible = true 
        end     
end) 

solved thank OGF and Castilho

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