multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 425 forks source link

moveObject bugged #1007

Open SScorpyo opened 5 years ago

SScorpyo commented 5 years ago

Describe the bug

Noticed a desync issue between the actual position of the object and the position of its visual after using high values (server sided, havent tried client) **To reproduce** Simple code to reproduce the problem ```lua local obj1 = createObject(10771,-1357.7, 532.4, 5.5,0,0,0) local x,y,z = getElementPosition(obj1) local rx,ry,rz = getElementRotation(obj1) local obj2 = createObject(10771,x,y,z,rx,ry,rz) setTimer(function() local a,b,c = getElementPosition(obj1) setElementPosition(obj2,a,b,c) end, 50, 0) moveObject(obj1, 560000, x+18000, y,z ) ``` **Screenshots** ![image](https://user-images.githubusercontent.com/46716845/59981194-0cc25080-95f8-11e9-85b4-c90786397b56.png) **Version** *Client:* Multi Theft Auto v1.5.6-release-16588.5 *Server:* MTA:SA Server GNU/Linux x64 v1.5.6-9.16569.0
ghost commented 5 years ago

Please test clientside. Desync serversided might be caused by Server <==> Client syncronization aswell as your 50ms timer (which is actually not really 50ms, but ~ 52ms)

patrikjuvonen commented 5 years ago

549 probably related

SScorpyo commented 5 years ago

Please test clientside. Desync serversided might be caused by Server <==> Client syncronization aswell as your 50ms timer (which is actually not really 50ms, but ~ 52ms)

Client side works fine, and i used the timer way just to demostrate, there is another way which is moving the ship using the same settings, waiting few seconds then stop it using stopObject, it will suddently move much further than the visual object youve been seing.

local obj1 = createObject(10771,-1357.7, 532.4, 5.5,0,0,0)
local x,y,z = getElementPosition(obj1)
local rx,ry,rz = getElementRotation(obj1)
moveObject(obj1, 560000, x+18000, y,z )
setTimer(stopObject,16000,1,obj1)

this video shows it https://streamable.com/4zey3

Also noticed that this only happens if you use high values, like if i devide the values i used up there it on 100 it will work fine