loops Posted December 11, 2013 Share Posted December 11, 2013 We just updated to Phaser 1.1.3 from 1.1.2. In Safari on Windows and iPad 2 iOS 6 my entities started behaving strangely. At first all my entities move as they used to, but after some amount of time they start moving very quickly and erratically. We changed the entities over to using velocity instead of acceleration, and things moved normally.This led us to this post: http://www.html5gamedevs.com/topic/1989-physicsframe-rate-bug-fix/.I changed the lines described in that post back to what was in 1.1.2, and everything went back to moving normally with acceleration. At first I thought the issue might be with a difference in physicsElapsed between browsers, but after logging the values they look pretty much the same (same order of magnitude).Thoughts? Link to comment Share on other sites More sharing options...
rich Posted December 11, 2013 Share Posted December 11, 2013 Could you try this for me please. In ArcadePhysics.computeVelocity, replace it with this: computeVelocity: function (axis, body, velocity, acceleration, drag, max) { max = max || 10000; if (axis == 1 && body.allowGravity) { velocity += this.gravity.x + body.gravity.x; } else if (axis == 2 && body.allowGravity) { velocity += this.gravity.y + body.gravity.y; } if (acceleration !== 0) { velocity += acceleration * this.game.time.physicsElapsed * 0.5 * 60; } else if (drag !== 0) { this._drag = drag * this.game.time.physicsElapsed * 0.5 * 60; if (velocity - this._drag > 0) { velocity -= this._drag; } else if (velocity + this._drag < 0) { velocity += this._drag; } else { velocity = 0; } } if (velocity > max) { velocity = max; } else if (velocity < -max) { velocity = -max; } return velocity; },It should update the acceleration and drag to use the same formula as velocity. Be curious to know what sort of results you get. Link to comment Share on other sites More sharing options...
loops Posted December 11, 2013 Author Share Posted December 11, 2013 Just gave that a shot, it actually made everything move more erratically! It may just be that the accelerations end up having a much stronger effect.In Chrome, the drag appears to be much more powerful with that code, entities stop a lot faster. I wish I knew why old Safari versions behave so much differently than Chrome/Firefox/new Safari on this. Link to comment Share on other sites More sharing options...
rich Posted December 11, 2013 Share Posted December 11, 2013 Let me try and emulate your settings here. What acceleration, velocity, drag, etc values do you have set? (and most importantly, what caps are set). Link to comment Share on other sites More sharing options...
loops Posted December 11, 2013 Author Share Posted December 11, 2013 The problems come up most often on the entities with the highest accelerations - somewhere between 1000 and 5000. These entities have a drag of 25 (yes - this probably isn't noticeable), and a max velocity of 75.We do see the behavior on entities that have lower accelerations, in the 100s, still with a max velocity around 75, but drags with similar magnitude to the acceleration. I understand that currently some of our values are a bit ridiculous in their magnitude, but since they currently work in other browsers in a way that we like we haven't seen much reason to change them. Link to comment Share on other sites More sharing options...
Recommended Posts