Xwad Posted October 26, 2016 Share Posted October 26, 2016 How can i freeze the camera? i tryied this but it does not work function fc() local cam = getElementsByType ( "camera" ) setElementFrozen ( localPlayer, cam ) end addCommandHandler("fd",fc) Link to comment
!#NssoR_) Posted October 26, 2016 Share Posted October 26, 2016 You can't freeze it , but you can use setCameraMatrix to put the camera at certain position. And use setCameraTarget to return the camera to the player. Link to comment
koragg Posted October 26, 2016 Share Posted October 26, 2016 Well, depending on what you want to achieve here are two things. 1st: If you want to lock the camera's target to a specific location or object, use setCameraMatrix 2nd: If you want to make the player to not be able to move at all, use setElementFrozen(localPlayer, true) Link to comment
Mr.Loki Posted October 27, 2016 Share Posted October 27, 2016 to freeze my cams i do a,b,c,d,e,f = getCameraMatrix() setCameraMatrix(a,b,c,d,e,f) locally of course Link to comment
Simple0x47 Posted October 27, 2016 Share Posted October 27, 2016 (edited) You can use this, you just have to trigger the event onClientIsFreezed when the player is being freezed. addEvent("onClientIsFreezed", true) addEvent("onClientIsUnFrozen", true) local freezed = false local fx, fy, fz, ftx, fty, ftz function saveXYZ() fx, fy, fz, ftx, fty, ftz = getCameraMatrix() freezed = true end addEventHandler("onClientIsFreezed", root, saveXYZ ) function unfroze() freezed = false fx, fy, fz, ftx, fty, ftz = nil, nil, nil, nil, nil, nil end addEventHandler("onClientIsUnFrozen", root, unfroze) function check() if ( freezed == true ) then local nx, ny, nz, ntx, nty, ntz = getCameraMatrix() if ( nx ~= fx ) or ( ny ~= fy ) or ( nz ~= fz ) or ( ntx ~= ftx ) or ( nty ~= fty ) or ( ntz ~= ftz ) then setCameraMatrix( fx, fy, fz, ftx, fty, ftz ) end end end addEventHandler("onClientRender", root, check ) Edited October 27, 2016 by Simple01 Added unfrozen function + Fixed spelling error 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