Search in
Sort by:

Question Status:

Search help


[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.

Product Version: UE 4.9
more ▼

asked Sep 08 '15 at 09:20 PM in C++ Programming

avatar image

74 12 17 22

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

Cheers, Elewyth

more ▼

answered Sep 09 '15 at 10:52 AM

avatar image

407 24 19 34

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:


Follow this question


Answers to this question