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 can I check what a projectile hit?

How can I check what my projectile hit in my scene?

I basically want this, I know it is incorrect, but it shows basically what I want:


I just can't figure out how to do this.

Product Version: UE 4.9
more ▼

asked Sep 02 '15 at 10:41 AM in Blueprint Scripting

avatar image

604 34 26 45

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

1 answer: sort voted first


This is basic setup. For example I used First Person Projectail from FP template.

For collision component I added OnComponentHit event and use Hit output to get the name of object which was hitted.

Add boolean variable Fire! for registered only first hit. Default Fire! is False.

Add Actor variable Name type and set the object with needed name.

alt text

In FirstPersonCharacter blueprint in Spawn projectile section, set the variable Fire! in True.

alt text

You will get a message on screen, when your projectile hit object with name FirstPersonCube_Rounded2. All other objects in scene will be ignored

project2.png (444.7 kB)
project.png (302.3 kB)
more ▼

answered Sep 02 '15 at 12:35 PM

avatar image

8.5k 254 42 400

avatar image MrGoatsy Sep 02 '15 at 01:25 PM

Is there no way to detect all objects in a scene? Because when it hits a NPC of which I plan to have multiple it needs to do damage(already figured that out), when it hits a destructible mesh it needs to do XX and when it hits a static mesh it needs to do XXXX(X being a placeholder for the action), I don't want it to detect one object, I want it to automatically detect the object.

avatar image erinacea Sep 05 '15 at 05:49 PM

That's exactly what Interfaces are for. You declare one function ReactToHit (or whatever) in the interface. Then for each of the classes implementing the interface, this function could do something different. It's really extremely flexible.

avatar image svv3dUDN Sep 02 '15 at 02:46 PM

You can use Blueprint Interface. And when projectile hit on object, object will print own name.

Create Blueprint Interface.

alt text

Open all base blueprints and add this interface to them. When You add interface, you can create Events named like function in BP Interface.

alt text

Open projectile BP and add function from BP Interface.

alt text

And after hit, all objects will be return its name in scene.

hitname01.png (78.3 kB)
hitname02.png (283.9 kB)
hitname03.png (322.4 kB)
avatar image MrGoatsy Sep 02 '15 at 02:51 PM

But then I still need to manually check what each name is, is there no way to find out what the object is automatically?

Not the name, the object type.

avatar image erinacea Sep 05 '15 at 05:53 PM

If all you want is the object type, you can use the Get Class node. If you want, you can then use the result to, for example, compare against a specific object class.

(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