GuiDocs
GuiDocs

Reputation: 732

Physicsjs getTarget is undefined

I'm trying to make a custom behavior and I'm not very familiar with physicsjs. According to the docs in github I'm supposed to use var bodies = this.getTargets(); to iterate through the bodies , but I keep getting an undefined is not a function error. fiddle

What am I doing wrong?

Upvotes: 0

Views: 75

Answers (1)

Jasper
Jasper

Reputation: 1193

Looks like the physicsjs version was 0.5.2 in the jsFiddle. The method getTargets was only introduced in 0.6. Here's an updated version of the fiddle.

http://jsfiddle.net/r8xum92m/3/

also make sure to use .on() instead of .subscribe() now.

Upvotes: 2

Related Questions