Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by sonnyflex · Apr 19, 2016 at 09:51 PM · collision detection

Detect collision on certain area of an object

Hello,

I'm new to Unity and I have a question on game logic: I want to make a game where you can make a snow ball battle as throwing snow balls on each other.

How can I detect on which area of the models body is the impact of a snow ball? How can I get the force that arises on the impact?

Thanks for help :)

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

2 Replies

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

Answer by Naphier · Apr 19, 2016 at 10:08 PM

You'll need to add a collider to the specific body part (or one that surrounds the body part). I'm not quite sure what you're asking about "the force that arises on impact". If you have a rigidbody collider on both objects the impacted body will automatically have the correct amount of force applied to it. If you want to manually calculate this then that's a bit more complex and I'd suggest cracking open some physics books. Hope this helps.

Comment
Add comment · Show 4 · 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 sonnyflex · Apr 19, 2016 at 10:36 PM 0
Share

Ok thanks, no that's good when the amount is calculated automatically. :)

avatar image sonnyflex · Apr 19, 2016 at 10:58 PM 0
Share

How to add a collider, is it added to the whole model, to each bone or to the mesh?

Now let's say the impact is on the upper arm and I want to detect in detail on which area of the upper arm is the collision. How could I detect on which polygons of the mesh or which are of a bone the impact is?

avatar image Naphier sonnyflex · Apr 19, 2016 at 11:00 PM 0
Share

Requires individual colliders for each area you want to check.

avatar image sonnyflex Naphier · Apr 19, 2016 at 11:16 PM 0
Share

So I resume, please correct me if I'm wrong: I have to add rigidBody to the models and to the snowballs. For the snowballs I can use Sphere Collider. For the models I found $$anonymous$$esh Collider.

What I don't understand is how to use $$anonymous$$esh Collider for the purpose mentioned above (eg detect certain area of upper arm)? What do you mean with "individual colliders for each area you want to check"?

avatar image
0

Answer by jgodfrey · Apr 19, 2016 at 10:08 PM

You'll want to use the OnCollisionEnter event, which is passed an instance of the Collision class. That class should contain everything you need including contact points, impact velocity, etc. Check out the docs here:

http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnCollisionEnter.html

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 sonnyflex · Apr 19, 2016 at 10:37 PM 0
Share

Ok I see that's nice, thanks!

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

57 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Which of Mulitipe colliders OnCollisionEnter ? 0 Answers

Evading obstacles 0 Answers

Trouble with detecting collision in the same frame to make smart labels 0 Answers

Collisions problem in VR 0 Answers

OnCollisionEnter() from non monobehaviour script 1 Answer


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