0
\$\begingroup\$

I'm working on a little "Tower of Hanoi" AR game in Unity using Vuforia, where the game is projected onto an image target.
Now I wanted to make the rings "fall" into place, so I added an invisible ground floor plane, with a box collider, and added mesh collider and rigid body to my ring.

Here are the settings: enter image description here enter image description here

Now there are quite a few questions about objects falling through the floor around and I tried many of the different suggestions (thickness of box collider, continuous instead of discrete collision detection,...) but none of them solved my issue.

Since this is my second little Unity project, I guess the issue is obvious (maybe my ring is too small (few centimeters) or something, but I'm not sure.

The problem is also, that I can't really see what is happening during runtime, since the camera has to find the image target first, after that the ring (currently testing only the bottom one) is gone and I just see the y-value of it's position changing.

Any help is much appreciated!

\$\endgroup\$
5
  • 1
    \$\begingroup\$ I have just tested out the same configuration on new test object, where I just have the torus and a plane with box collider. There it works fine, and the torus is stopped by the plane \$\endgroup\$ Jan 22, 2020 at 10:53
  • \$\begingroup\$ Is it possible your bottom ring is starting a little too low, so it's already penetrating the floor on spawn, and gets pushed out the wrong side? \$\endgroup\$
    – DMGregory
    Jan 22, 2020 at 10:59
  • \$\begingroup\$ @DMGregory No, but I think that I have just found the problem. World coordinates, I guess, are dependent on the AR camera, so when I start my game "down" might be any direction. Therefore the ring could just fly in any direction. \$\endgroup\$ Jan 22, 2020 at 11:02
  • \$\begingroup\$ Ah. You might then want to have your rings start with a fixed joint holding them in place, or their rigidbodies set to kinematic so the physics engine doesn't try to move them with forces and momentum. Then, after your AR setup has had a few frames to settle, break the fixed joints or rest the bodies to dynamic to let them move again. That'll save you from most weirdness at startup time. \$\endgroup\$
    – DMGregory
    Jan 22, 2020 at 11:05
  • \$\begingroup\$ Yes, thank you. I will try and test into that direction. \$\endgroup\$ Jan 22, 2020 at 11:06

1 Answer 1

1
\$\begingroup\$

Maybe you are making a simple mistake, for collision there is no need to add joints and all that. Just make sure to take these steps:

  • add both side collider (3d or 2d as per game type)
  • add Rigidbody for physics.
  • don't tick isTrigger if you want collision.
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .