I noticed this completely by accident, but I fear this library is not stable enough to use because of this. I ended up with an extra b2Vec2 that I wasn't using, so I deleted it, but it caused my physics spawn to stop working. Made some other changes and now I had to add two unused b2Vec2 instances to get it to work. Makes absolutely no sense. All I can think is it's some kind of odd race condition?
// this "zero" vec2 does nothing and is not referenced anywhere but if I comment it out nothing spawns
const zero = new b2Vec2(0, 0)
const pos = new b2Vec2(options.x, options.y)
let shape
const fixture = new b2FixtureDef()
fixture.density = 1.0
fixture.friction = 0.3
shape = new b2CircleShape()
shape.m_radius = options.radius
const bodyDef = new b2BodyDef()
bodyDef.set_type(b2_dynamicBody)
bodyDef.set_position(pos)
const body = this.world.CreateBody(bodyDef)
body.CreateFixture(fixture)
body.SetTransform(pos, 0)
body.SetAwake(true)
body.SetEnabled(true)
I noticed this completely by accident, but I fear this library is not stable enough to use because of this. I ended up with an extra b2Vec2 that I wasn't using, so I deleted it, but it caused my physics spawn to stop working. Made some other changes and now I had to add two unused b2Vec2 instances to get it to work. Makes absolutely no sense. All I can think is it's some kind of odd race condition?