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 -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -