Trigger event on movement/location change
What would be the best way to trigger an event when an actors location is being changed?
asked Nov 04 '14 at 04:21 PM in Blueprint Scripting
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.
answered Nov 04 '14 at 05:10 PM
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.
answered Jul 16 '17 at 09:25 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here