Managing a number of collision in a single body

Managing a number of collision in a single body

[ad_1]

Managing a number of collision in a single body – Recreation Improvement Stack Change







Recreation Improvement Stack Change is a query and reply web site for skilled and impartial recreation builders. It solely takes a minute to enroll.

Signal as much as be part of this neighborhood

Anyone can ask a query

Anyone can reply

One of the best solutions are voted up and rise to the highest

Requested

Seen
3 instances

$begingroup$

I’ve a object with field collider that spins 360 diploma earlier than destroying itself. I’ve a whole lot of enemies spawning across the participant. The article spawns, spins and destroys itself. Think about it like scythe. However just some enemies are getting broken and a few will not be. The code is given under

 personal void OnTriggerEnter2D(Collider2D collision)
 {
     harm(collision.gameObject);
 }

 void harm(GameObject different)
 {
     if (different.gameObject.CompareTag("Enemies"))
     {
         //Damaging the enemy
         different.gameObject.GetComponent<Health_Enemy>().well being -= Harm;
         different.gameObject.GetComponent<Health_Enemy>().examine();
     }
 }
```

$endgroup$

You need to log in to reply this query.

default

 

[ad_2]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Scroll to Top