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"

How to destroy static mesh when bullet hit ?

I am making a game in which i use static mesh cube as object and i want to destroy it when i fire a bullet ( or Line trace or Projectile ball ) on it.so how i can destroy it when i fire bullet on static mesh.

Product Version: UE 4.18
Tags:
more ▼

asked Feb 14 '19 at 04:14 PM in Using UE4

avatar image

VIROH
1 1 3

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

3 answers: sort voted first

you just need a reference to the object to destroy then use the destroy actor node. so in the case of a projectile actor you could use a on hit event then use the other actor pin as the target for a destroy actor. if using a line trace you would use the hit result.

alt text

capture.png (231.1 kB)
more ▼

answered Feb 14 '19 at 11:25 PM

avatar image

ThompsonN13
10.1k 33 10 25

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

I try this but i got a new problem that all the static mesh present in game is destroying ( boxes and floor which is present in game are also destroying when trace is hit ). I want to destroy only the bottles when trace is hit

screenshot-8.png (113.7 kB)
screenshot-9.png (957.9 kB)
more ▼

answered Feb 16 '19 at 07:29 AM

avatar image

VIROH
1 1 3

avatar image ThompsonN13 Feb 16 '19 at 03:26 PM

In that case you just need to add in another check. I would either use a custom collision channel or ise tags. If using tags you can just get the other actor and i believe theres a node for has tag.

avatar image VIROH Feb 17 '19 at 03:52 AM

Like this ?

screenshot-10.png (255.5 kB)
avatar image ThompsonN13 Feb 17 '19 at 02:38 PM

yea basically. then you just need to select the actor class you want to be able to destroy and give it the needed tag.

your basically just looking for indicator in the actor that tells you this is one i want to be destroyable.

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

I would recommend using on component hit -> cast to the bulltet So inside of every object I would make it destroy it self when hit by a bulltet or if you want you could also make the object count the hits and disappear after X hits...

In the screenshot provided I used collisions to make a claymore explode when a projectile hits it directly. It also explodes when a nade detonates in a larger radius and (not included in the screenshot) when a player walks inside the smaller collision, he dies.

I hope this helps :Dalt text

screen1.jpg (317.2 kB)
more ▼

answered Feb 16 '19 at 09:38 AM

avatar image

Max2066
10 1 4

(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