javascript - 如何防止元素在 p5 中穿过我的墙壁?
问题描述
我使用 ml5 -posenet 进行了面部跟踪交互。现在我希望跟踪粒子留在特定区域。所以我建立了一个边界。不知何故,它仍在运行。但它显示在控制台中,检测到碰撞,我已经将声音作为一个事件放在它上面,所以碰撞本身似乎不是问题。
if(noseX> rect1X -rect1Width &&
noseX < rect1X + rect1Width &&
noseY > rect1Y- rect1Height &&
noseY < rect1Y + rect1Height) {
mySound.play();
console.log('nose collided with blue');
noseXchange*= -1;
noseYchange*= -1;
解决方案
推荐阅读
- .net - 并行压缩大文件(~30 GB)?
- javascript - 创建自定义 JS 语法/速记
- asp.net - 为什么视图状态大小会如此增加
- angular - 收到与可观察的 Angular2 相关的错误
- apache - 成功安装 IBM HTTP 服务器后不显示主页
- android - 如何在 Android Studio 的 Logcat 中每行显示 n 条记录?
- facebook - Instagram API,待审核
- c# - Microsoft.ServiceBus.NamespaceManager - 托管服务标识 (MSI)
- php - 按值对php数组进行排序,从小到大排序
- java - AWS - 允许其他账户使用 KMS (Java) 读取和解密 DynamoDB 数据