*when you change the position of an object, the position of the object its stuck to gets updated at the end of the frame. so you can’t use the object.X/Y() to get the new changed position axis inside the same frame. *
So my feature request is to give a option to update sticked objects position change in the same frame, right when the basis objects position is changed.
something like “Update Position Immediately” and “Update Position at the end of the Frame”
@MrMen@Silver-Streak
Thanks for the help, ive found the problem. It’s the sticked objects, their position does not get updated in the same frame, Ive changed the title.
They do get updated in the same frame, just after all the events have been processed.
If you open the extension in the editor, you can see the behaviour process doStepPostEvents calls up followBasisObject(), which is defined at the end of the DefineHelperClasses functions script.
You could modify the extension by adding another behaviour function to call the followBasisObject(). You’d then move the main object, call the newly added function and then get the stuck object’s updated position.
It’s feels a tad hacky, but it’ll get the result you’re after.
In order to do that, you’d have to call a function to expressly. The way it is designed. you stick 2 object together and that’s it, the post event handles the rest for you. No more remembering to call update functions. It’s a really neat, clean implementation and perfect for nearly all the times it gets used.
Yes im sure, but updating the sticked object coordinates not only at the end of a frame but whenever the basis objects position is changed, would make the behavior generally a little better without compromises, I guess. But maybe more expensive?
Getting the position of a sticked object at anytime, like non-sticked objects, seems something that has to be added, sooner or later.
Your use case sounds like it is not a great use case for the stick object extension, and instead you should be updating the positions via events and variables.
Why so? if I move the base object, then the stuck objects position is wrong because it is not updated and using any position expression to get the stuck objects actual position directly would therefore not work.
Sorry for the confusion, to clarify: Events in general are designed to run once per frame, barring repeats/for each/while statements.
The behavior is built around that concept, for both an optimization and general logic standpoint. In order to make the behavior work as you wanted, it would need to be firing off multiple times per frame, which could potentially change expected behavior for other users, and may not be technically feasible as it isn’t going to know when people want it to update, nor can it monitor for changes easily.
What you are asking for seems out of scope for the design of the behavior and feels specific to your use case, which is why it feels more appropriate for you to either edit the behavior for you project, or not use it and do the tracking as you desire directly.