【问题标题】:PhysicsJS - How to find a body by its label (or other value)PhysicsJS - 如何通过标签(或其他值)找到身体
【发布时间】:2016-02-25 00:07:06
【问题描述】:

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

此代码返回错误:Uncaught TypeError: Cannot read property 'label' of undefined

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

【问题讨论】:

  • 我认为它不需要数组而是对象:world.findOne({ label: ball });
  • MiMo,这是正确的答案。有用!谢谢。

标签: javascript physicsjs


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-10
    相关资源
    最近更新 更多