Check if an actor has moved

Hello. I would like to check if an actor has moved.
Specifically, I have a line trace by channel when left mouse is pressed, and I would like to recalculate it if the actor’s position has changed by the time the player has let go of LMB.

I’ll test this out and get back to you ASAP with any further questions/ result. Thanks!

Well you will need to store the location somewhere.

So create a new vector variable. On LMB pressed set that variable to the current character location.

On LMB released you simply compare the current character location with that vector variable (via the “equal” node).

I hope this helps.

Cheers,

Erasio

Alright. So I tested it out and it works, but It’s not necessarily what I need.
I have something that marks the location of the area where the line trace hit. So if I move around and while holding LMB and then let go of it, the hit area of the ray channel won’t nevessarily be the same as the marker area.

I think I found a better alternative, which is onActorMoved(). This is a C++ function however, is there a blueprint equivalent to this?

Not that I know of. But what would be the difference?

After adding a branch you can do that raycast again and use that location.

Or am I missing something?

I tried to keep my explanation simple, but if I have two scenarios one with the location-variable one (1) and the other with a working onActorMoved blueprint (2). I have a marker that marks where the object will spawn once LMB is released. Marker becomes visible when LMB is pressed, and becomes invisible once it’s released.

  1. LMB is pressed, location is stored, linetrace marker appears. → Character moves → LMB is released and Before spawning the object that will be spawned at the line trace hit area the variable is checked against the current actors location. If it’s changed move the Line-trace-marker over to that spot, but also spawn the actor at that spot, removing the marker. In this scenario the marker was only at the correct spot for a really small time between the time it takes to spawn an object at that place and delete it
  2. LMB is pressed, marker teleports the line trace area → character moves around, onActorMoved() fires off and the location of the marker is moved around, the player has a chance to see where it is. → LMB is released, the player knows where the created object will be, since the marker has moved around with him/ her.
    I’m pretty bad at explaining, sorry!

To solve my case I did
Event Tick → If(actorAccelration != 0){
//Do what you need to do when he moves
}

24173-capture.png

Event tick! That’s what I was missing. Thanks you!