Matthew Cooley Posted April 9, 2015 Share Posted April 9, 2015 EDIT: wrong forum, sorry! Should be in phaser 2. I have the box2d plugin for Phaser (which is rad), but I've run into a problem when changing states. The problem being that the game crashes. I'm trying to determine if this is a bug in box2d or Phaser (in which case I will have to just modify the library myself which I'd rather not do), or if I am just doing something wrong. The chain of events that I've been able to trace:1. I change the state2. Phaser calls clear on the physics. 3. inside clear, a new box2d.b2World world is created: clear: function () { this.world = new box2d.b2World(this.gravity);inside that function it tries to called Clone() on that gravity parameter...box2d.b2World = function (gravity){ ... yadda yadda yadda ... this.m_gravity = gravity.Clone();4. Crash The only other time new box2d.b2World is ever called is thusly:this.world = new box2d.b2World(new box2d.b2Vec2(0, 0)); But 'this.gravity' that is passed on clear() is not a b2Vec2, its a Phaser.Physics.Box2D.PointProxy object. I don't totally understand this object, but I see when its created it has a gravity getter and setter passed in. But either way, when Clone is called on this object it crashes. So my question is... is this a bug? Or is there a way around this? Link to comment Share on other sites More sharing options...
deniz Posted April 23, 2015 Share Posted April 23, 2015 Today I encountered same problem. Changing states causes box2d plugin to throw an exception. Link to comment Share on other sites More sharing options...
Recommended Posts