[C++] Check if object moved
How can I check if an object moved since last frame? Theoreticly I could store an old location vector at the end of Tick function and when new Tick begins, subtract new location vector from old(previous) location vector. The result would show if location was changed or not. The problem is location is updated after Tick so both vectors running at same tick would give same values.
asked Sep 08 '15 at 09:20 PM in C++ Programming
If your object is using the CharacterMovementComponent, you can retrieve the movement vector from there, and check if it's size is > 0. If not, you probably need to stick to saving an old position vector. For your problem with the location being updated after Tick, it should still work they way you are trying to do it. Yes, you may not be able to detect the change in position in the same tick as the position changes, but you WILL pick up the change the following Tick. If you can make due with the change in position being recognized 1 Tick late, there shouldn't be any problems with your approach.
answered Sep 09 '15 at 10:52 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here