New expressions: PrevX(), PrevY(), MovementDirection(), DistanceMoved() #3642
Replies: 4 comments
-
|
Do you think these should be included by default, or can we back these into a "MovementTracker" behavior? Having a behavior has the interesting aspect that we would not consume memory (to store the previous position) for all objects, and we could also expand this "tracker" to include more features (inspect the movement like the distance moved over the last X seconds?) |
Beta Was this translation helpful? Give feedback.
-
|
StateSaveExt.zip |
Beta Was this translation helpful? Give feedback.
-
|
Nice! You think we could make this an extension on the registry? |
Beta Was this translation helpful? Give feedback.
-
|
Maybe though that draft was made quickly more as a PoC than a real solution, and still needs to be worked on. I'm a bit busy with another extension right now but I can see later if I can look further into it if no one else is interested in finishing it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Provide expressions that describe how the object moved in the last frame:
object.PrevX() OR object.X(-1)
object.PrevY() OR object.Y(-1)
object.MovementDirection()
object.DistanceMoved()
Alternatives considered
"object.ForceDistance()" and "object.ForceAngle()" sound exactly what I wanted, but they only take into account movement caused by forces. This means it does not include movement initiated by platformer/top-down/physics behaviors, mouse dragging, manual position changes, etc.
"object.Direction()" sounds like the right thing, but it appears to be functionally similar to "object.Angle()".
These expressions can be manually calculated by saving the last frame position and comparing it to the current frame (like FaceForward does) but I think these expressions should be included by default.
Beta Was this translation helpful? Give feedback.
All reactions