@@ -161,54 +161,6 @@ Phaser.Physics.Arcade = function (game) {
161161
162162Phaser . Physics . Arcade . prototype = {
163163
164- /**
165- * Called automatically by a Physics body, it updates all motion related values on the Body.
166- *
167- * @method Phaser.Physics.Arcade#updateMotion
168- * @param {Phaser.Physics.Arcade.Body } The Body object to be updated.
169- updateMotion: function (body) {
170-
171- // If you're wondering why the velocity is halved and applied twice, read this: http://www.niksula.hut.fi/~hkankaan/Homepages/gravity.html
172-
173- // Rotation
174- this._velocityDelta = (this.computeVelocity(body, body.angularVelocity, body.angularAcceleration, body.angularDrag, body.maxAngular, 0) - body.angularVelocity) * 0.5;
175- body.angularVelocity += this._velocityDelta;
176- body.rotation += (body.angularVelocity * this.game.time.physicsElapsed);
177- body.angularVelocity += this._velocityDelta;
178-
179- if (body.allowGravity)
180- {
181- // Gravity was previously applied without taking physicsElapsed into account
182- // so it needs to be multiplied by 60 (fps) for compatibility with existing games
183- this._gravityX = (this.gravity.x + body.gravity.x) * 60;
184- this._gravityY = (this.gravity.y + body.gravity.y) * 60;
185- }
186- else
187- {
188- this._gravityX = 0;
189- this._gravityY = 0;
190- }
191-
192- body.motionVelocity.x = (this.computeVelocity(body, body.velocity.x, body.acceleration.x, body.drag.x, body.maxVelocity.x, this._gravityX) - body.velocity.x) * 0.5;
193- body.motionVelocity.y = (this.computeVelocity(body, body.velocity.y, body.acceleration.y, body.drag.y, body.maxVelocity.y, this._gravityY) - body.velocity.y) * 0.5;
194-
195- // Horizontal
196- // this._velocityDelta = (this.computeVelocity(body, body.velocity.x, body.acceleration.x, body.drag.x, body.maxVelocity.x, this._gravityX) - body.velocity.x) * 0.5;
197- // body.velocity.x += this._velocityDelta;
198- // body.x += (body.velocity.x * this.game.time.physicsElapsed);
199- // body.velocity.x += this._velocityDelta;
200-
201- // Vertical
202- // this._velocityDelta = (this.computeVelocity(body, body.velocity.y, body.acceleration.y, body.drag.y, body.maxVelocity.y, this._gravityY) - body.velocity.y) * 0.5;
203- // body.motionVelocity.y = this._velocityDelta;
204-
205- // body.velocity.y += this._velocityDelta;
206- // body.y += (body.velocity.y * this.game.time.physicsElapsed);
207- // body.velocity.y += this._velocityDelta;
208-
209- },
210- */
211-
212164 /**
213165 * Called automatically by a Physics body, it updates all motion related values on the Body.
214166 *
@@ -262,9 +214,6 @@ Phaser.Physics.Arcade.prototype = {
262214 }
263215 }
264216
265- // velocity = velocity + gravity*delta_time/2
266- // position = position + velocity*delta_time
267- // velocity = velocity + gravity*delta_time/2
268217 // temp = acc*dt
269218 // pos = pos + dt*(vel + temp/2)
270219 // vel = vel + temp
@@ -274,62 +223,6 @@ Phaser.Physics.Arcade.prototype = {
274223
275224 } ,
276225
277- /**
278- * A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
279- *
280- * @method Phaser.Physics.Arcade#computeVelocity
281- * @param {Phaser.Physics.Arcade.Body } body - The Body object to be updated.
282- * @param {number } velocity - Any component of velocity (e.g. 20).
283- * @param {number } acceleration - Rate at which the velocity is changing.
284- * @param {number } drag - Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set.
285- * @param {number } [max=10000] - An absolute value cap for the velocity.
286- * @param {number } gravity - The acceleration due to gravity. Gravity will not induce drag.
287- * @return {number } The altered Velocity value.
288- computeVelocity: function (body, velocity, acceleration, drag, max, gravity) {
289-
290- max = max || 10000;
291-
292- // velocity = (acceleration + gravity) * this.game.time.physicsElapsed;
293- // velocity += (acceleration + gravity) * this.game.time.physicsElapsed;
294- velocity = (acceleration + gravity);
295-
296- if (acceleration === 0 && drag !== 0)
297- {
298- this._drag = drag * this.game.time.physicsElapsed;
299- // this._drag = drag;
300-
301- // if (velocity - drag > 0)
302- if (velocity - this._drag > 0)
303- {
304- // velocity += this._drag;
305- velocity -= drag;
306- }
307- // else if (velocity - drag < 0)
308- else if (velocity - this._drag < 0)
309- {
310- // velocity -= this._drag;
311- velocity -= drag;
312- }
313- else
314- {
315- velocity = 0;
316- }
317- }
318-
319- if (velocity > max)
320- {
321- velocity = max;
322- }
323- else if (velocity < -max)
324- {
325- velocity = -max;
326- }
327-
328- return velocity;
329-
330- },
331- */
332-
333226 /**
334227 * Called automatically by the core game loop.
335228 *
0 commit comments