|
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
(comments are locked)
|
|
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. Thankyou Duck, this is a great answer, thanks for the clarity and detail and especially the explaination of
Apr 21 '10 at 02:13 PM
ImaginaryHuman
(comments are locked)
|
|
Use box colliders for the quads.
(comments are locked)
|
|
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 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
Aug 07 '10 at 06:49 PM
ImaginaryHuman
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 instead 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
Aug 07 '10 at 06:52 PM
ImaginaryHuman
(comments are locked)
|
|
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,.
(comments are locked)
|
|
So there is no such thing as a flat collider that will collide edge-on, it has to be a collider with depth? Please don't post comments as answers. It makes baby jesus cry.
Apr 16 '10 at 09:30 PM
dhendrix
(comments are locked)
|

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?
@ImaginaryHuman, should you return, please checkmark the right answer, thanks.