problem defining multiple physics objects via json data
Shri

Gio,

I was fooling around with the physics stuff, just dropping some soccer balls on a mouse click.The physics data is read from a json file, which I modelled on the stuff that gets created in the wade online editor.

I am having a problem defining multiple physics objects via their json definition. If I define the data inline in the source file, I can define multiple objects with the same data. However, if I define multiple objects using the data from a json file, then it doesn't work, the call stack looks like this

wade.physics_3.5.js:1556 Uncaught TypeError: Cannot read property 'x' of undefinedaddFixture
@ wade.physics_3.5.js:1556q
@ wade.physics_3.5.js:1549onAddToScene
@ wade.physics_3.5.js:1551SceneObject.process
@ wade_3.5.js:221SceneObject.processEvent
@ wade_3.5.js:220SceneManager.addSceneObject
@ wade_3.5.js:191Wade.addSceneObject @ wade_3.5.js:378onMouseDown
@ framework.js:129InputManager.event_mouseDown @ wade_3.5.js:64

Not sure what I am doing wrong. I have attached a zip file of the code if you want to take a look.

cheers - shri

All 2 Comments
Gio

Hi Shri

Many thanks for your post, it's helped me find a typo in wade.isPlainObject. That's ultimately the cause of your problem.

I think I might be able to release a new version with this and a couple other bug fixes later today.

Gio

Done.

Upgrading to the latest version (3.5.1) should fix your problem.

Post a reply
Add Attachment
Submit Reply
Login to Reply