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
Post a Comment