Skip to content

Commit c893c5c

Browse files
committed
Body.reset and Body.destroy added.
1 parent 8a71a21 commit c893c5c

1 file changed

Lines changed: 39 additions & 7 deletions

File tree

v3/src/physics/impact/Body.js

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,28 @@ var Body = new Class({
5858
this.slopeStanding = { min: 0.767944870877505, max: 2.3736477827122884 };
5959
},
6060

61-
reset: function ()
61+
reset: function (x, y)
6262
{
63-
// TODO
63+
this.pos = { x: x, y: y };
64+
this.last = { x: x, y: y };
65+
this.vel = { x: 0, y: 0 };
66+
this.accel = { x: 0, y: 0 };
67+
this.friction = { x: 0, y: 0 };
68+
this.maxVel = { x: 100, y: 100 };
69+
70+
this.standing = false;
71+
72+
this.gravityFactor = 1;
73+
this.bounciness = 0;
74+
this.minBounceVelocity = 40;
75+
76+
this.accelGround = 0;
77+
this.accelAir = 0;
78+
this.jumpSpeed = 0;
79+
80+
this.type = TYPE.NONE;
81+
this.checkAgainst = TYPE.NONE;
82+
this.collides = COLLIDES.NEVER;
6483
},
6584

6685
update: function (delta)
@@ -89,11 +108,6 @@ var Body = new Class({
89108
}
90109
},
91110

92-
handleMovementTrace: function (res)
93-
{
94-
return true;
95-
},
96-
97111
skipHash: function ()
98112
{
99113
return (!this.enabled || (this.type === 0 && this.checkAgainst === 0 && this.collides === 0));
@@ -150,6 +164,24 @@ var Body = new Class({
150164
collideWith: function (other, axis)
151165
{
152166
// Overridden by user code
167+
},
168+
169+
handleMovementTrace: function (res)
170+
{
171+
// Overridden by user code
172+
173+
return true;
174+
},
175+
176+
destroy: function ()
177+
{
178+
this.enabled = false;
179+
180+
this.world = null;
181+
182+
this.gameObject = null;
183+
184+
this.parent = null;
153185
}
154186

155187
});

0 commit comments

Comments
 (0)