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"

How to detect when spawned actor touches other actor

Hello, I'm a beginner with Unreal.

So what I'm trying to do is spawn a bullet which would fly foward, if it touches one of the randomly spawned EnemyAI Actors then the EnemyAI would be destroyed and the player would get points. ![alt text][1]

What I've done for the spawned bullet movement is when you press a key, it moves forward using Forward Vector (wherever the Player is facing).

The problem is, I have no idea how to detect when the spawned bullet touches any of the spawned EnemyAI Actors... I've only worked with the Player Character touching actors... Not other actors. How should I get this to work? Thanks.

alt text alt text

Product Version: UE 4.19
bullet.png (143.4 kB)
firebullet.png (128.1 kB)
more ▼

asked Oct 29 '18 at 04:37 AM in Blueprint Scripting

avatar image

9 1 1 4

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

1 answer: sort voted first

A linetrace with the hit info, (for checking distant hits) or overlap events should do the trick.

Also, a delay in a tick works?

more ▼

answered Oct 29 '18 at 06:09 AM

avatar image

98 2 5 8

avatar image PixelOmen Oct 29 '18 at 07:07 AM

A delay in a tick technically works, but it can have unexpected results. It almost acts more like a gate when used in a tick. Once a delay has been called once, it stops responding to future calls to it, and the nodes after, until the delay has been completed. In other words, the calls don't "queue up", so to speak, only the first one actually executes.

avatar image timsev7n Oct 29 '18 at 07:54 AM

Very interesting!

avatar image Kiragami- Oct 29 '18 at 06:26 PM

Hello, thank you for help.

I never was never taught Linetrace and don't really know where to begin with this... I tried to Google for tutorials but basically everything I seen so far is for First Person, while I'm using Third Person (I think that makes quite a dif too?). Also quite a few things I've seen look quite complex, I barely know where to start.

Any tips would help please, like where should I connect it for my current BPs to grab the locations of both my bullet and any of the spawned EnemyAI...

avatar image PixelOmen Oct 30 '18 at 03:30 AM

It doesn't matter if it's First or Third Person, you can run a trace from anywhere, line or otherwise. The important part is figuring out how to get the start/end locations (vectors). You should get comfortable with figuring out how to get the location and rotations of objects (actors, components, etc) in the world. It's very difficult to do anything else if you don't have a good grasp on that.

That said, you really don't need a trace in this case. You can do what you want with just an overlap event. You can call the overlap event on the bullet BP.

(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