Sunday 15 January 2012

javascript - Console.log object velocity with box2d -



javascript - Console.log object velocity with box2d -

i'm trying console.log velocity of object box2dweb should possible velocity next method getlinearvelocity() i'm not sure how do? i've tried next ways:

var heromove = getlinearvelocity().hero; console.log('heromove');

and

var heromove = getlinearvelocity('hero'); console.log('heromove');

in console message:

referenceerror: getlinearvelocity not defined

it's easy answer, seems there no doc jquery.box2d , can't see whats wrong?

i found solution myself. looks this:

var herovelx = game.currenthero.getlinearvelocity().x; var herovely = game.currenthero.getlinearvelocity().y; console.log("x =", herovelx + "y =", herovely);

the value of geltlinearvelocity() vector , not number , therefor has specified x , y. hope else can utilize it.

javascript jquery console.log box2dweb

No comments:

Post a Comment