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

121 Views Asked by At

How should the findOne method be properly used? (http://wellcaffeinated.net/PhysicsJS/docs/#Physics-world-prototype-findOne)

This code returns the error: Uncaught TypeError: Cannot read property 'label' of undefined

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

There are 1 best solutions below

0
On BEST ANSWER

I think it does not expect an array but an object: world.findOne({ label: ball });