PhysicsJS - 如何通过标签(或其他值)查找主体

PhysicsJS - How to find a body by its label (or other value)

本文关键字:其他 查找 主体 何通过 标签 PhysicsJS      更新时间:2023-09-26

应该如何正确使用findOne方法?(http://wellcaffeinated.net/PhysicsJS/docs/#Physics-world-prototype-findOne)

此代码返回错误:未捕获的类型错误:无法读取未定义的属性"标签"

var theBall = world.findOne([{ label: ball }];

我认为它不需要数组而是对象:world.findOne({ label: ball });