0
votes

I`m using Vuforia plugin Unity, I added 3D Water can to my scene, and make it child to the Ground Plane Stage, when I run the game the object occurs, I add Box Colliders to both Ground Plane Stage and the Water can, also I add rigidbody to the can , when running the game the can fall through ground (doesn't stop falling ) How Can I fix this and make water can stop falling ? I use Vuforia 7.5.26

1
Do you really need rigidbody in your 3D water can? If so why not making it kinematic?Ali Kanat
I design a game and I want objects to falling and stop at ground , and the layer can drag it then when release it , it will fall again .Dalia Najeh

1 Answers

0
votes

Okay the problem is your object starts falling when you press play regardless of whether you found a plane or not to solve this problem add rigidbody to both ground plane and your water can. Uncheck use gravity in both of them. Then add these lines to your OnTrackingFound function in DefaultTrackableEventHandler

 var rigidBody = GetComponentsInChildren<Rigidbody>(true);

 foreach (var component in rigidBody)
        {
            if (component.name == "Cube")
                component.useGravity = true;
        }

This will cause gravity to apply to your water can when you click on the screen. You can modify it to usecase for lifting and dropping. But the main problem is applying gravity before detecting ground. Good luck!