Open lukebitts opened 11 years ago
User data does not work properly. Instead use this._body.whateverYouWant = "hello";
which works just fine.
On 2013-06-29, at 6:23 PM, Lucas Bittencourt notifications@github.com wrote:
The following (inside a constructor):
var body_def = new b2BodyDef(); body_def.set_type(Box2D.b2_dynamicBody); body_def.get_position().Set(0,0);
var shape_def = new b2CircleShape(); shape_def.set_m_radius(7/30);
var fixture_def = new b2FixtureDef(); fixture_def.set_density(0.0); fixture_def.set_friction(0.0); fixture_def.set_shape(shape_def);
this._body = this._world.CreateBody(body_def); this._body.CreateFixture(fixture_def);
this._body.SetUserData(this); console.log(this._body.GetUserData()); Prints 0 on the console. I'm trying to detect collision between two objects but without the user data I can't see the difference between them.
— Reply to this email directly or view it on GitHub.
The following (inside a constructor):
Prints
0
on the console. I'm trying to detect collision between two objects but without the user data I can't see the difference between them.