tommymaster Posted July 5, 2018 Share Posted July 5, 2018 (edited) local x, y, z = 134.52067565918, -69.88720703125, 2.4778761863708 local marker = createMarker (x, y, z) addEventHandler ("onClientRender", root, function() x, y, z = interpolateBetween (x, y, z, x, y, z + 3, 0, "Linear") setElementPosition (marker, x, y, z) end) Hi i'd like to move a marker from my position, to up, but the script is not working at all. It is not giving any error but the marker is not moving. Edited July 5, 2018 by tommymaster Link to comment
Mr.Loki Posted July 5, 2018 Share Posted July 5, 2018 Use moveObject instead and do not use it in render. Link to comment
tommymaster Posted July 5, 2018 Author Share Posted July 5, 2018 (edited) i dont know how long the interpolation would be... Edited July 5, 2018 by tommymaster Link to comment
Mr.Loki Posted July 5, 2018 Share Posted July 5, 2018 Do you want to marker to keep moving forever? Link to comment
tommymaster Posted July 5, 2018 Author Share Posted July 5, 2018 i dont want to right now, but i wonder how may i do it, maybe with timers? Link to comment
Mr.Loki Posted July 5, 2018 Share Posted July 5, 2018 For it to work you need to increase the progress argument from 0-1 over time like this local x, y, z = 134.52067565918, -69.88720703125, 2.4778761863708 local marker = createMarker (x, y, z) local start = getTickCount( ) local length = 3000 -- 3 seconds addEventHandler ("onClientRender", root, function() local progress = (getTickCount( )-start)/length local x, y, z = interpolateBetween (x, y, z, x, y, z + 3, progress, "Linear") setElementPosition (marker, x, y, z) end) 1 Link to comment
tommymaster Posted July 5, 2018 Author Share Posted July 5, 2018 (edited) thx! Edited July 5, 2018 by tommymaster 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