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

Delphi change the assembly code of a running process -

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

C++ 11 "class" keyword -