var a = new b2Vec2( 9, 6 );
var b = new b2Vec2( 2, 3 );
a.op_add(b);
console.log( a.get_x() + ", " + a.get_y() );
... prints "11, 9" -> correct
Changing the third line to
a.op_sub(b);
... prints "9, 6" -> incorrect
Interestingly, assigning the return value like:
var c = a.op_sub(b);
console.log( c.get_x() + ", " + c.get_y() );
... prints "-9, -6" while:
var c = a.op_add(b);
console.log( c.get_x() + ", " + c.get_y() );
... gives: Uncaught TypeError: Cannot call method 'get_x' of undefined
On a related note:
a.op_set(b);
... gives: Uncaught TypeError: Object # has no method 'op_set'
Given that embind will replace these bindings I guess this is very low priority, but I just thought I would point out that there is something weird going on here :)
This:
... prints "11, 9" -> correct
Changing the third line to
... prints "9, 6" -> incorrect
Interestingly, assigning the return value like:
... prints "-9, -6" while:
... gives: Uncaught TypeError: Cannot call method 'get_x' of undefined
On a related note:
... gives: Uncaught TypeError: Object # has no method 'op_set'
Given that embind will replace these bindings I guess this is very low priority, but I just thought I would point out that there is something weird going on here :)