Jump to content

[setCameraMatrix] server side update camera?


Recommended Posts

Hello ,

I would like to update the camera every time the chair moves.

I already tried something but it isnt working, it keeps looking at the same position and isnt following the object

This need to be server side (or atleast the chair need to stay server side)!

Also i need something to reset the camera back to normal but i dont have a clue how to do that , i tried setCameraTarget(player) but then it looks at the neck.

  
local chair = createObject ( 1671, -1326, -67, 13355, 0, 0, 0 )  
  
function test(player) 
x,y,z = getElementPosition(chair) 
setCameraMatrix(player,x,y,z) 
end 
addCommandHandler("test123",test) 
  

Link to comment
  • Moderators
local x,y,z = getElementPosition(chair) 
local sx,sy,sz,_,_,_ = getCameraMatrix(player) 
if not sx then 
sx,sy,sz = getElementPosition(player) 
end 
setCameraMatrix(player,sx,sy,sz,x,y,z) 

I don't know what you want, explain better with less nonsense.

  
local lastPosition = {} 
setTimer(function () 
if not lastPosition then 
local x,y,z = getElementPosition(chair) 
if getDistanceBetweenPoints3D(x,y,z,lastPosition[1],lastPosition[2],lastPosition[3]) > 0.1 then 
outputChatBox("chair moved!") 
lastPosition = {x,y,z} 
end 
else 
lastPosition = {getElementPosition(chair)} 
end 
end,100,0) 
  

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