Luke_Ferrara Posted May 28, 2010 Share Posted May 28, 2010 how can a script the camera so it will back up take a 90 degree turn go forward and get an aerial view of an object? Link to comment
Gamesnert Posted May 29, 2010 Share Posted May 29, 2010 I'm pretty sure all you need is: onClientPreRender setCameraMatrix Some Lua knowledge A lot of maths I doubt there's a much easier way. Link to comment
Dark Dragon Posted May 29, 2010 Share Posted May 29, 2010 and easy way would be creating 2 invisible objects, which you use moveObject on then get their coordinates in onClientPreRender -> setCameraMatrix Link to comment
Cannonball Posted May 29, 2010 Share Posted May 29, 2010 and easy way would be creating 2 invisible objects, which you use moveObject on then get their coordinates in onClientPreRender -> setCameraMatrix Or 2 small objects -> setElementAlpha Link to comment
Dark Dragon Posted May 29, 2010 Share Posted May 29, 2010 thats what i meant basically. Link to comment
Luke_Ferrara Posted May 29, 2010 Author Share Posted May 29, 2010 could I have an example on how that would work? Link to comment
Dark Dragon Posted May 29, 2010 Share Posted May 29, 2010 local obj1 = createObject(1337,0,0,5) setElementAlpha(obj1,0) local obj2 = createObject(1337,-5,5,4.5) setElementAlpha(obj2,0) fadeCamera(true) moveObject(obj1,30000,5,0,5) moveObject(obj2,30000,10,5,4.5) addEventHandler("onClientPreRender",getRootElement(), function() local cx,cy,cz = getElementPosition(obj1) local tx,ty,tz = getElementPosition(obj2) setCameraMatrix(cx,cy,cz,tx,ty,tz) end ) Link to comment
Luke_Ferrara Posted June 4, 2010 Author Share Posted June 4, 2010 it doesn't work I still don't firmly understand, I know that setCameraMatrix sets the camera and it's suppose to set it to the object and move the object but the code doesn't move the camera back it just sits there...heres my code function setCameraOnPlayerJoin() local obj1 = createObject(1337, 805.09777832031, -2780.2409667969, 9.3761787414551) setElementAlpha(obj1,0) local obj2 = createObject(1337, 821.29284667969, -2780.1831054688, 9.3761787414551) setElementAlpha(obj2,0) moveObject(obj1,30000,821.29284667969, -2780.1831054688, 9.3761787414551) moveObject(obj2,30000,821.45483398438, -2786.248046875, 11.3835067749023) fadeCamera(source, true, 5) local cx,cy,cz = getElementPosition(obj1) local tx,ty,tz = getElementPosition(obj2) setCameraMatrix(source, cx,cy,cz,tx,ty,tz) end addEventHandler("onPlayerLogin",getRootElement(), setCameraOnPlayerJoin) Link to comment
Dark Dragon Posted June 5, 2010 Share Posted June 5, 2010 it just stays because you set the camera matrix only once. use client side code and set the camera matrix within onClientPreRender, like in my example Link to comment
Luke_Ferrara Posted June 5, 2010 Author Share Posted June 5, 2010 okay now it is working however I want it to follow a path so i created a midpoint where one object would pick up where the other one left off..how would I do this? Link to comment
50p Posted June 8, 2010 Share Posted June 8, 2010 okay now it is working however I want it to follow a path so i created a midpoint where one object would pick up where the other one left off..how would I do this? ... A lot of maths ... Link to comment
vovo4ka Posted June 8, 2010 Share Posted June 8, 2010 If you needed advanced camera for machinima you can use stage resource. You can take result like real movie camera Link to comment
Luke_Ferrara Posted June 15, 2010 Author Share Posted June 15, 2010 If you needed advanced camera for machinima you can use stage resource. You can take result like real movie camera how can I use that in-game? I need it because in my server you can create a character but when you click create character the camera moves to a new room and you can create your skin there however i need to move left but the moveObject only can move in one direction and i need to move back and then left...how can I accomplish this? Link to comment
50p Posted June 15, 2010 Share Posted June 15, 2010 You can use timers to move objects in different directions at different times. But what vovo4ka wanted to say is you can use stage resource which lets you feel like movie "director" (and I think that would be better name for such resource). Link to comment
Luke_Ferrara Posted June 16, 2010 Author Share Posted June 16, 2010 but how can i bring that into my game mode???? I created what i want with the stage resource and got a .std file when I include that in my meta it doesnt do anything! I need the camera to move when a gui button is clicked and some peds doing activities in the back but when I start this it does nothing this resource is for recording movies with a video camera or playback recorder Link to comment
vovo4ka Posted June 17, 2010 Share Posted June 17, 2010 Now you can't. These files works only with stage. Now I'm working on API for playing this files in other resourses Link to comment
Luke_Ferrara Posted June 17, 2010 Author Share Posted June 17, 2010 Yeah so I please get an example of how to do it with the timers and everything? Link to comment
Dark Dragon Posted June 17, 2010 Share Posted June 17, 2010 local obj1 = createObject(1337,0,0,5) setElementAlpha(obj1,0) local obj2 = createObject(1337,-5,5,4.5) setElementAlpha(obj2,0) fadeCamera(true) function move1() moveObject(obj1,30000,5,0,5) moveObject(obj2,30000,10,5,4.5) setTimer(move2,30000,1) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),move1) function move2() moveObject(obj1,30000,0,0,5) moveObject(obj2,30000,-5,5,4.5) setTimer(move1,30000,1) end addEventHandler("onClientPreRender",getRootElement(), function() local cx,cy,cz = getElementPosition(obj1) local tx,ty,tz = getElementPosition(obj2) setCameraMatrix(cx,cy,cz,tx,ty,tz) end ) this would make the camera loop between those 2 states i used before. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now