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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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.

Product Version: Not Selected
Tags:
more ▼

asked Dec 15 '14 at 12:38 AM in Blueprint Scripting

avatar image

ShrewGlue
434 97 83 107

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

capture.png (60.5 kB)
more ▼

answered Dec 16 '14 at 12:18 AM

avatar image

ShrewGlue
434 97 83 107

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Dec 15 '14 at 10:52 PM

avatar image

Erasio
5.9k 291 86 293

avatar image ShrewGlue Dec 15 '14 at 10:53 PM

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

avatar image ShrewGlue Dec 15 '14 at 11:16 PM

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?

avatar image Erasio Dec 15 '14 at 11:29 PM

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?

avatar image ShrewGlue Dec 15 '14 at 11:36 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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