Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Hathakas · Jan 13, 2015 at 09:31 PM · nearest

How to make projectile do AOE/Splash Damage (2D)

Hello, I have two objects here, they're very close together to make it look like one board. they each have a polygon collider, and they are children of an empty gameobject with a box collider.

Right now, I have it so that when the box collider gets hit, both boards become kinematic = false. So it looks like it cracks in half lol. Now my questions is, is there a way not to use a parent? and just have the nearest collider or rigidbody become not kinematic? I guess what I'd like to know is if there is anything for "NEAREST" or "Within a certain radius". I would want to have it so, if one board gets hit, the other board will take half damage as well. I will be using this on many object and most will have more than 2 objects attached. I'm currently using this code but it's taking too long to get each object sorted out.

 void OnCollisionEnter2D (Collision2D collision) {
     if (collision.collider.tag != "Rock")
     return;
         
         Destroy(this.collider2D);
         gameObject.GetComponentsInChildren<Rigidbody2D>();
         rig1.isKinematic = false;
         rig2.isKinematic = false;
   
         

alt text

Thank you in Advance! :)

untitled picture.png (85.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by cdrandin · Jan 14, 2015 at 03:06 AM

A simple way for AoE type collision could be to use a Sphere which acts as your hit box(sphere). Then to reduce calculation you only do this check when it is within a close enough distance for it to even be touching.

So, hopefully what you want is you have this object be within a certain distance of an object which is tagged as "Destructible" for instance. When the object is in fact colliding, you trigger the corresponding objects DestroyAnimation, which will break in half, etc..

Hopefully, this help. It was hard to understand what you were asking for.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hathakas · Jan 14, 2015 at 03:54 AM 0
Share

Thanks! That's what I'm going to work on next. It makes a lot of sense!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How can I make my gameObject find the nearest object with a specific tag and rotate to look at it? 6 Answers

How could I calculate the distance to recieve the nearest object to the player? 2 Answers

Detect closest reachable point of object 1 Answer

Constantly looking for nearest object 4 Answers

Locking onto enemies with the third person controller 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges