spenkbang Posted February 2, 2019 Share Posted February 2, 2019 Can anyone tell me how this works? I'm trying to call from the server: getCameraMatrix( getElementsByType("player")[1] ) But it returns false. Works fine from the client. From the docs I see the camera is updated at 500ms by default.. just not sure how to access it Link to comment
AncienT Posted February 2, 2019 Share Posted February 2, 2019 51 minutes ago, spenkbang said: Can anyone tell me how this works? I'm trying to call from the server: getCameraMatrix( getElementsByType("player")[1] ) But it returns false. Works fine from the client. From the docs I see the camera is updated at 500ms by default.. just not sure how to access it Probably not getting the player. Link to comment
spenkbang Posted February 2, 2019 Author Share Posted February 2, 2019 inspect() shows that the player is ok. It looks like getCameraMatrix() only works after you use setCameraMatrix, so it seems not useful for getting a synced camera. Maybe there's just no way to access the synced camera data from the server? Link to comment
Simple. Posted February 2, 2019 Share Posted February 2, 2019 53 minutes ago, spenkbang said: inspect() shows that the player is ok. It looks like getCameraMatrix() only works after you use setCameraMatrix, so it seems not useful for getting a synced camera. Maybe there's just no way to access the synced camera data from the server? Quote Note: The server-side version of this function returns the last camera matrix that was set by the server, and thus does not necessarily indicate the current matrix of the camera (since it may have been changed client-side). Link to comment
spenkbang Posted February 2, 2019 Author Share Posted February 2, 2019 Thus why I am asking if there is a way to get the players' camera matrices as internally used by the server Link to comment
Peti Posted February 2, 2019 Share Posted February 2, 2019 Why do you need such thing? Maybe there are other ways. Link to comment
Feche1320 Posted February 2, 2019 Share Posted February 2, 2019 Call client function getCameraMatrix and return it to server Link to comment
spenkbang Posted February 2, 2019 Author Share Posted February 2, 2019 4 hours ago, Peti said: Why do you need such thing? Maybe there are other ways. I want to create objects at points which are not likely to be seen by players in the server. 1 hour ago, Feche1320 said: Call client function getCameraMatrix and return it to server This seems to be the best option for now. Though I'd rather use less bandwidth, not ask the client for variables which the server (seemingly) already has access to Link to comment
Discord Moderators Pirulax Posted February 2, 2019 Discord Moderators Share Posted February 2, 2019 (edited) It always returns false server-side.Bug report here. Edited February 2, 2019 by Pirulax 1 Link to comment
KillerX Posted February 2, 2019 Share Posted February 2, 2019 18 hours ago, spenkbang said: Can anyone tell me how this works? I'm trying to call from the server: getCameraMatrix( getElementsByType("player")[1] ) But it returns false. Works fine from the client. From the docs I see the camera is updated at 500ms by default.. just not sure how to access it getCameraMatrix Shared function This function gets the position of the camera and the position of the point it is facing. Note: The server-side version of this function returns the last camera matrix that was set by the server, and thus does not necessarily indicate the current matrix of the camera (since it may have been changed client-side). Link to comment
Feche1320 Posted February 3, 2019 Share Posted February 3, 2019 14 hours ago, spenkbang said: I want to create objects at points which are not likely to be seen by players in the server. This seems to be the best option for now. Though I'd rather use less bandwidth, not ask the client for variables which the server (seemingly) already has access to If you don't need very accurate positions, math.floor the coordinates. Anyways, assuming MTA 'fixes' this issue, you are going to be using the same amount of bandwidth vs calling the client fix, since the server will ask the client the camera matrix constantly to have it updated on server-side Link to comment
Discord Moderators Pirulax Posted February 6, 2019 Discord Moderators Share Posted February 6, 2019 Math.floor-ing coordinates doesn't help: in MTA Lua is configured to use 64 bit doubles, so even an int will be represented as a 64 bit double. 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