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 /
avatar image
2
Question by ImaginaryHuman 1 · Apr 16, 2010 at 06:35 PM · 2dcollisionphysicsgraphicsflat

Colliding 2 completely flat quads with physics?

Imagine you have imported 2 completely flat 2d quads from some 3d app and they are now in the Unity scene, positioned so that you're basically looking at them as two squares on the screen side by side, not necessarily touching.

Now, with Unity's physics (colliders, rigidbody, whatever), if I push one of those quads horizontally toward the other quad so that their edges would collide, will it actually collide or will they pass right through each other?

My concern is that the quads have no depth and therefore they won't collide? ie I guess the physics system cannot do proper 2d you have to always have some depth to your objects to make them collide?

Comment
Add comment · Show 2
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 ImaginaryHuman 1 · Apr 16, 2010 at 06:36 PM 0
Share

I should clarify that obviously you need to add some kind of physics collider/rigidbody to do any colliding... but my point is, will they collide as completely flat objects if the colliders are flat?

avatar image Cyclops · Jun 26, 2010 at 01:50 PM 0
Share

@ImaginaryHuman, should you return, please checkmark the right answer, thanks.

5 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by duck · Apr 20, 2010 at 09:40 AM

No, you can't have completely flat moving physics objects (rigidbodies).

You can have completely flat objects which act as Static Colliders - for example, a ground plane which doesn't move. To do this, you would just have a plane with a collider component but no rigidbody component attached.

However, if you have a completely flat object (eg, unity's built-in plane), with a Mesh Collider (so that it uses the objects mesh as the collision volume), and you try to add a Rigidbody component, you will get an error from the physics engine.

This is because the rigidbody needs some volume in order to have mass, inertia, and these things are impossible to compute if the rigidbody has no volume.

If you assign a Box Collider to a game object with a completely flat mesh, the box collider will automatically give itself a tiny amount of depth so that it performs correctly.

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 ImaginaryHuman.du · Apr 21, 2010 at 02:13 PM 0
Share

Thankyou Duck, this is a great answer, thanks for the clarity and detail and especially the explaination of why this is the case.

avatar image
2

Answer by Eric5h5 · Apr 16, 2010 at 07:08 PM

Use box colliders for the quads.

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
1

Answer by Cosmin · Aug 06, 2010 at 11:13 AM

I have same problem i need to have collision bettwen particles in xoy plane and a 2d map also in xoy plane but i can not find a way to do it... if u got any solutions that oyu can share it will be good

Comment
Add comment · Show 2 · 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 ImaginaryHuman.du · Aug 07, 2010 at 06:49 PM 0
Share

See the above answer from Duck. Unity has kind of two aspects to its collision detection system, one is the collider, the other is the rigid body. The collider can be used to detect that something collided with something else, but not with any reaction. You need rigidbody for it to calculate a proper reaction. Or at least, that's how it seems to me. Like Duck said you can have a flat plane with a collider, and since the plane doesn't move it works. So it depends if you have moving objects, which you probably do.

avatar image ImaginaryHuman.du · Aug 07, 2010 at 06:52 PM 0
Share

You could write your own 2D collision routine if you want it to be simple.. e.g. collide rectangles and simply check if the rectangles overlap and then move the quads manually to simulate physics. But if you want to use Unity's physics then you have to give your objects some volume. Your flat quad has to become a box with volume. So long as you use an orthographic projection ins$$anonymous$$d of perspective you'll never see the sides of the box, just the front. Then the physics engine can collide the boxes properly. You can also use rigid body to make the object only rotate in z with no z movement

avatar image
0

Answer by ImaginaryHuman 1 · Apr 16, 2010 at 09:27 PM

So there is no such thing as a flat collider that will collide edge-on, it has to be a collider with depth?

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 dhendrix · Apr 16, 2010 at 09:30 PM 0
Share

Please don't post comments as answers. It makes baby jesus cry.

avatar image
0

Answer by Fathom · Mar 16, 2011 at 03:54 PM

well the colliders are invisible so you can make the collider thicker, anyway way i see it but i get what you saying bu cant say i have tried it and you can make the colliders a faction whider so you wont notice how close they might come,.

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

No one has followed this question yet.

Related Questions

rigidbody2D.addforce in collider 1 Answer

How do I get the player and the object they touch both disappear/destroyed? 1 Answer

2D platformer. Let player slide under object. 1 Answer

Change shape of object upon collision 1 Answer

2D Colliders do not register collision 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