x

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"

Trigger event on movement/location change

What would be the best way to trigger an event when an actors location is being changed?

Product Version: Not Selected
Tags:
more ▼

asked Nov 04 '14 at 04:21 PM in Blueprint Scripting

avatar image

looper
73 4 5 10

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

2 answers: sort voted first

You can do it during the tick if you save the location and check against the previous location, but that would be expensive if you have a lot of objects doing that operation. Alternatively you could keep track of the actions that might cause a change of location (input for example or collision). I am not aware of any event that is triggered by a change of location, so I think you will need to create one yourself and from there call your other event.

more ▼

answered Nov 04 '14 at 05:10 PM

avatar image

BaderThanBad
664 21 18 177

avatar image looper Nov 04 '14 at 06:13 PM

I see. Think I'll try to do a check against previous location, as I have it now it's on every tick and it doesn't seem to be too much. Thank you so much for the fast help!

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

An easy way to achieve this would be to just use a boolean. Create a blueprint of the actor you want to move, create a bool called "Moved"? and when you run your code to move the actor, set the value of the bool to true. Then in your level blueprint (or character depending on if you want to use this functionality in multiple levels or not) connect a branch node to the Event Tick, get an instance of your actorBP, get the "Moved?" bool, connect it to the branch, hook a DoOnce node to the true pin so the event tick only fires it once and then run your code from there.

more ▼

answered Jul 16 '17 at 09:25 PM

avatar image

TorQueMoD
1.1k 81 110 142

(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