Jump to content

[HELP] HElp with Camera


LiOneLMeSsI

Recommended Posts

onPlayerJoin --event 
--then 
setCameraMatrix 
--for moving use the above function with this event: 
onClientPreRender 

Actually!! Yea :D Right it Helped Much...but actually it's only setCameraMatrix...and i need the camera moves....not only looks in one Positions...Means i want it to switch the position...I hope you got it :D

I use this

function setCameraOnPlayerJoin() 
     fadeCamera(source, true, 5) 
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) 
end 
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) 

Link to comment
So, you got a list of camera locations and you want it to set a random one from that table?

I want the camera Show all locations ..like when the camera show the location..it shows the another while the camera's moving.

ALright look.

   function setCameraOnPlayerJoin() 
         fadeCamera(source, true, 5) 
         setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) 
         setCameraMatrix(source, 2941.5, -2051.6999511719, 3.2999999523163, 12, 0, 270)  
  
    end 
    addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) 
  

I have added 2 Locations...and Only one work..i want the both work...like one work...after 3 seconds the another work...Understand what i mean...

Link to comment

Nevermind, i tought that you wanted to move the camere from one place to anothe with interpolating, use Solidsnake's one:

local camTable = 
    { 
        { 1262, -1154, 96,1190, -1195, 58 }, --cs,cy,cz,cpx,cpy,cpz 
        { 512.2, -1263.57, 32.53,542.16, -1287.07, 17.24 } 
    } 
local cameras = { } 
  
function firstSlider ( ) 
    cameras [ source ] = 0 
    setTimer ( 
        function ( thePlayer ) 
            cameras [ thePlayer ] = ( cameras [ thePlayer ] + 1 ) 
            setCameraMatrix ( thePlayer, unpack ( camTable [ cameras [ thePlayer ] ] ) ) 
            fadeCamera ( thePlayer, true, 1 ) 
        end, 1000, 2, source 
    ) 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), firstSlider ) 

Link to comment
Nevermind, i tought that you wanted to move the camere from one place to anothe with interpolating, use Solidsnake's one:
local camTable = 
    { 
        { 1262, -1154, 96,1190, -1195, 58 }, --cs,cy,cz,cpx,cpy,cpz 
        { 512.2, -1263.57, 32.53,542.16, -1287.07, 17.24 } 
    } 
local cameras = { } 
  
function firstSlider ( ) 
    cameras [ source ] = 0 
    setTimer ( 
        function ( thePlayer ) 
            cameras [ thePlayer ] = ( cameras [ thePlayer ] + 1 ) 
            setCameraMatrix ( thePlayer, unpack ( camTable [ cameras [ thePlayer ] ] ) ) 
            fadeCamera ( thePlayer, true, 1 ) 
        end, 1000, 2, source 
    ) 
end 
addEventHandler ( "onPlayerLogin", getRootElement(), firstSlider ) 

Yes man i want to move the camera from place to another with moveObject...not just photos..i mean like VIdeo...

Link to comment

What can't you understand in this:

local sm = {} 
sm.moov = 0 
sm.object1, sm.object2 = nil, nil 
  
function removeCamHandler () 
    if(sm.moov == 1) then 
        sm.moov = 0 
        removeEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
    end 
end 
  
function camRender () 
    local x1, y1, z1 = getElementPosition ( sm.object1 ) 
    local x2, y2, z2 = getElementPosition ( sm.object2 ) 
    setCameraMatrix ( x1, y1, z1, x2, y2, z2 ) 
end 
  
function smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time ) 
    if(sm.moov == 1) then return false end 
    sm.object1 = createObject ( 1337, x1, y1, z1 ) 
    sm.object2 = createObject ( 1337, x1t, y1t, z1t ) 
    setElementAlpha ( sm.object1, 0 ) 
    setElementAlpha ( sm.object2, 0 ) 
    setObjectScale(sm.object1, 0.01) 
    setObjectScale(sm.object2, 0.01) 
    moveObject ( sm.object1, time, x2, y2, z2, 0, 0, 0, "InOutQuad" ) 
    moveObject ( sm.object2, time, x2t, y2t, z2t, 0, 0, 0, "InOutQuad" ) 
  
    addEventHandler ( "onClientPreRender", getRootElement(), camRender ) 
    sm.moov = 1 
    setTimer ( removeCamHandler, time, 1 ) 
    setTimer ( destroyElement, time, 1, sm.object1 ) 
    setTimer ( destroyElement, time, 1, sm.object2 ) 
    return true 
end 

Just put this on the client side with the codes provided above:

addEventHandler ( "onClientResourceStart", resourceRoot, function() 
smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time ) 
end) 

Just fill in the values...

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