kasya85 Posted April 1, 2017 Share Posted April 1, 2017 (edited) camera is not moving, why?? local posX , posY , posZ = 1349.6624,-909.8301,91.9341; local posAtX , posAtY ,posAtZ = 180.6144,-850.0771,84.3115; addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () local sWidth,sHeight = guiGetScreenSize() guiCreateStaticImage (sWidth/2-200,sHeight/2-325, 400, 650, "logo.jpg", false) toggleControl("all", false) setPlayerHudComponentVisible("all", false) setCameraMatrix(posX, posY, posZ, posAtX, posAtY, posAtZ) fadeCamera(true) addEventHandler("onClientPreRender", getRootElement(), cameraUpdate) ShowCursor(true) end) function cameraUpdate() posX = PosX + 0.3; posAtX = posAtX + 0.3; setCameraMatrix(posX, posY, posZ, posAtX, posAtY, posAtZ) end Edited April 1, 2017 by kasya85 Link to comment
NeXuS™ Posted April 1, 2017 Share Posted April 1, 2017 Can you use <> tags, and not quote? Link to comment
Mr.Loki Posted April 1, 2017 Share Posted April 1, 2017 (edited) To make the camera move smoothly from point A to B use the interpolateBetween function. Try playing with this and test it out: local time = 10000 --10 seconds local start = getTickCount( ) --the start of the interpolation --Point A local x,y,z = 2046.943359375, 997.03973388672, 13.485786437988 --Point B local x2,y2,z2 = 2046.943359375, 1010, 13.485786437988 addEventHandler( "onClientRender", root, function ( ) local progress = (getTickCount( )-start)/time local x,y,z = interpolateBetween( x,y,z,x2,y2,z2, progress, "InOutQuad")-- create a new xyz of the updated position setCameraMatrix( x, y, z) end ) some examples https://streamable.com/68wwd https://streamable.com/3z931 Edited April 1, 2017 by Mr.Loki 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