Is your feature request related to a problem? Please describe.
We can move an object using moveObject() function, but we cannot know whether the object has finished moving.
Describe the solution you'd like
Add a new function isObjectMoving() which returns true if object moving or false otherwise. Add a new event onObjectMoved.
Describe alternatives you've considered
In some cases I can store target coords and then compare the current position with them, but it won't work with some types of easing (elastic, outback, bounce, etc).
Additional context
no
why not
moveObject( someTime, ... )
setElementData(object, "moving", getTickCount() + someTime )
function isObjectMoving(object)
local moving = getElementData(object, "moving")
return not moving or moving < getTickCount()
end
onObjectMoved implementation)I think o:isMoving() is suitable, yes.
Not sure if we should have an event, but if we did, it should be an event trigger when an object _stops_ moving. The scripter can simply then use onPreRender to follow a moving object.
🆗 Function: isObjectMoving (client)
🤔 Event: onClientObjectMoveFinish
👎 Event: onClientObjectMove
❓ Function: isObjectMoving (server) — only if the server currently tracks this.
🤔 Event: Server events
_If the server does not currently track object movement status_, adding this feature server-side should be done in a separate pull request to the client additions.
What happens if moveObject is called multiple times on the same object? If the object follows both movements; should we trigger a finish event when both "moves" are done, or trigger it per completed "move"?
I don't really like isObjectMoving, as it only conveys whether the object is moving at all. I'd be in favor of adding a method like getObjectMovementInfo which returns the current movement data (position/rotation/easing/time). As have that data available somewhere (for the actual moving), this should be fairly simple to add.
I'm not a fan of script-triggered events though.
@qaisjp I don't think parallel moveObjects are supported
Event: onClientObjectMove
When I wrote onClientObjectMoved I meant exactly what you said about onClientObjectMoveFinish. I.e. when object stops.
What happens if moveObject is called multiple times on the same object? If the object follows both movements; should we trigger a finish event when both "moves" are done, or trigger it per completed "move"?
Second call stops the first movement. It would be possible to trigger an event and pass an additional argument that would indicate whether the object reached target position or was stopped earlier (i.e. stopObject() was used).
👍 getObjectMovementInfo
What about the move finish event?
Most helpful comment
I don't really like
isObjectMoving, as it only conveys whether the object is moving at all. I'd be in favor of adding a method likegetObjectMovementInfowhich returns the current movement data (position/rotation/easing/time). As have that data available somewhere (for the actual moving), this should be fairly simple to add.I'm not a fan of script-triggered events though.
@qaisjp I don't think parallel moveObjects are supported