unity3d - 如何在 Unity Mapbox World Scale 中添加碰撞物理?
问题描述
在 World Scale AR 中,我想移动到使用 SpawnOnMap 放置的对象。当我触摸那个物体时,我希望那个物体被抹去。我让 Player 有一个名为 PlayerController 的脚本。我为该对象制作了一个标签,以便当它接触时,它应该破坏或将其设置为活动状态。当我走向物体时,什么也没有发生。我已经尝试过 OnTriggerEnter 和 OnCollisionEnter。Mapbox 提供了某种我缺少的方法吗?
public class PelletCollector : MonoBehaviour
{
public int count = 0;
// Start is called before the first frame update
void Start()
{
}
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Pellet")
{
count++;
Debug.Log("Collected Pellets: " + count);
other.gameObject.SetActive(false);
//Destroy(other.gameObject);
}
}
}
解决方案
推荐阅读
- visual-studio - 发布时从 3rd 方 Blazor 库中选择 wwwroot/_content/ 文件
- python - 通过 python SDK 将用户分配给 Azure Active Directory 企业应用程序
- rxjs - Observable 多次发出请求并一起收集响应
- html - CSS 网格 - 如何居中
- mysql - 在 WHERE 子句中使用子查询,但每个子查询结果限制为一个匹配项
- python-3.x - 带有 pil 图像的 tkinter 的奇怪行为
- javascript - 无法在反应类中声明常量
- python - Python单线程比CPU绑定中的两个线程慢
- javascript - 带有文本输入的自定义对话框 React Native
- spring-boot - 在 Gradle Spring Boot 项目中的 wsdl2Java 任务中将正确的路径传递给本地 WSDL 文件