Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question