穿过ARGroundPlane的3D对象 [英] 3D object falling through ARGroundPlane

查看:127
本文介绍了穿过ARGroundPlane的3D对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Vuforia插件Unity, 我在场景中添加了3D水罐,并使其成为了地平面舞台的子级,当我运行游戏时,该对象发生了,我在地平面舞台和水桶中都添加了Box Colliders,还向罐中添加了刚体,在运行游戏时,它可能掉落到地面(不会停止掉落) 我该如何解决并使水停止滴落的问题? 我使用Vuforia 7.5.26

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

推荐答案

好吧,问题是无论您是否找到一个平面,只要按下play键,物体就会开始掉落以解决此问题.水可以.取消选中两个都使用重力.然后将这些行添加到DefaultTrackableEventHandler

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!

这篇关于穿过ARGroundPlane的3D对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆