javascript - Store user data in CANNON.Body for later use? -



javascript - Store user data in CANNON.Body for later use? -

is possible store user info in cannon.body object later use? example:

var ballbody = new cannon.body({ mass: 1 }); ballbody.userdata = { name: 'tester' }; // ... world.add(ballbody); // ... player.addeventlistener('collide', function(e) { console.log(e.contact.bi.userdata.name); // ==> tester });

i figured out! info saved , kept in e.body.userdata in collide event.

javascript cannon.js

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

ubuntu - Bash Script to Check That Files Are Being Created -

Php operator `break` doesn't stop while -