abadabadu Posted July 20, 2015 Posted July 20, 2015 Hi. Im trying to predict some element position in future ( after 1 second). Gta returns velocity in meters per 1/50 seconds, so i need ot confirm my calculation. Is this right way? x, y, z = getElementPosition ( element ) sX, sY, sZ = getElementVelocity ( element ) -- Find predicted position after 1 second -- rich velocity in meters pre second ( not 1/50 second ) sX = sX * 50 sY = sY * 50 sZ = sZ * 50 -- predicted position. "1" is 1 second here, added it just to show predictedX = x + sX * 1 predictedY = y + sY * 1 predictedZ = Z + sZ * 1 Is this correct way to find element position after 1 second? Thanks!
Bonsai Posted July 20, 2015 Posted July 20, 2015 I did a little test, and seems more or less right. Appears its not not exactly 1/50 maybe. The calculated position was off by about 0.7 units.
abadabadu Posted July 20, 2015 Author Posted July 20, 2015 I did a little test, and seems more or less right. Appears its not not exactly 1/50 maybe. The calculated position was off by about 0.7 units. Show code of test please. Wich speed did u give to element in test?
Bonsai Posted July 20, 2015 Posted July 20, 2015 Already deleted the code again It was just setting the speed to 0.2 in a render function, checking the position twice with 1 second delay.
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