Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
3
Question by Petethegoat · Mar 05, 2016 at 03:53 PM · physicsphysics2ddocumentation

Collision.impulse 2D equivalent

For 3D collisions you have Collision.impulse. Is there an equivalent (or a way to get an equivalent value) for 2D collisions?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by samifruit514 · Jun 28, 2016 at 11:56 AM

you can calculate the bodies velocity magnitude over a couple of frames like in this thread: http://forum.unity3d.com/threads/getting-impact-force-not-just-velocity.23746/

look at Nutella's post

Comment
Add comment · 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
0

Answer by RodrigoSeVeN · Nov 01, 2017 at 10:38 PM

I'm migrating my game's physics from 3D to 2D and have just faced this same problem. After a lot of searching and testing a few methods, including the one on the previous answer, I couldn't get anywhere near the same results from Collision.impulse.


Finally, the most ok method I found, which has a lot of room for improvement, was to simply use Collision2D.OverlapPoint to check in a loop each point in the contacts array of the OnCollisionStay2D collision parameter, to see if any of the points were inside my object as such:

  if (collision.otherCollider.OverlapPoint(contact.point)) {}


Since I was using impulse to check if my object was being crushed, this method has been working well enough to replace it. It doesn't give you a nice number to work with, so it might not be what you needed. I thought it was better to share anyways, in case someone else is trying to crush a 2D physics object.


For those trying to crush an object, you might want to change the crushed object's layer so it doesn't collide with whatever crushed it any longer than necessary. It really depends on what you're trying to achieve.

Comment
Add comment · 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
0

Answer by racetrack · 12 hours ago

I posted a (kind of) solution here: http://answers.unity.com/answers/1906926/view.html

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

Predict next rigidbody position based on velocity 1 Answer

Vector3.normalize not behaving as expected? 1 Answer

Reset Rigidbody2D rotation after collision 2 Answers

Physic Material Friction Combine Mode lack of documentation? 2 Answers

Could someone elaborate on what the CompositeCollider2D.GeometryType documentation means by "unwanted collisions?" 0 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