mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Complete Box2D to Planck.js migration
- Replace Box2D.js with Planck.js physics engine - Update all require paths from 'Lib/Vendor/Box2D' to 'Lib/Vendor/Planck' - Convert Box2D contact listeners to Planck.js event system - Fix all method name capitalization (Get* -> get*, Set* -> set*) - Update collision detection system for Planck.js compatibility - Server now starts successfully and basic physics working - Character can land on platforms - core physics functional Major milestone: Game now running on modern, maintained physics engine
This commit is contained in:
parent
875abd60d9
commit
dc779def9c
43 changed files with 701 additions and 14524 deletions
10
app/Lib/Vendor/RubeLoader.js
vendored
10
app/Lib/Vendor/RubeLoader.js
vendored
|
|
@ -1,5 +1,5 @@
|
|||
define([
|
||||
"Lib/Vendor/Box2D",
|
||||
"Lib/Vendor/Planck",
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -72,7 +72,7 @@ function (Box2D) {
|
|||
ClipVertex = Box2D.Collision.ClipVertex,
|
||||
Features = Box2D.Collision.Features,
|
||||
IBroadPhase = Box2D.Collision.IBroadPhase;
|
||||
b2_dynamicBody = Box2D.Dynamics.b2Body.b2_dynamicBody;
|
||||
b2_dynamicBody = 'dynamic';
|
||||
b2ControllerEdge = Box2D.Dynamics.Controllers.b2ControllerEdge,
|
||||
IBroadPhase = Box2D.Collision.IBroadPhase,
|
||||
b2CircleContact = Box2D.Dynamics.Contacts.b2CircleContact,
|
||||
|
|
@ -194,7 +194,7 @@ function (Box2D) {
|
|||
fd.shape.m_radius = fixtureJson.circle.radius;
|
||||
if ( fixtureJson.circle.center )
|
||||
fd.shape.m_p.SetV(fixtureJson.circle.center);
|
||||
var fixture = body.CreateFixture(fd);
|
||||
var fixture = body.createFixture(fd);
|
||||
if ( fixtureJson.name )
|
||||
fixture.name = fixtureJson.name;
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ function (Box2D) {
|
|||
for (v = fixtureJson.polygon.vertices.x.length - 1; v >= 0 ; v--)
|
||||
verts.push( new b2Vec2( fixtureJson.polygon.vertices.x[v], -fixtureJson.polygon.vertices.y[v] ) );
|
||||
fd.shape.SetAsArray(verts, verts.length);
|
||||
var fixture = body.CreateFixture(fd);
|
||||
var fixture = body.createFixture(fd);
|
||||
if ( fixture && fixtureJson.name )
|
||||
fixture.name = fixtureJson.name;
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ function (Box2D) {
|
|||
var thisVertex = new b2Vec2( fixtureJson.chain.vertices.x[v], -fixtureJson.chain.vertices.y[v] );
|
||||
if ( v < fixtureJson.chain.vertices.x.length - 1 ) {
|
||||
fd.shape.SetAsEdge( lastVertex, thisVertex );
|
||||
var fixture = body.CreateFixture(fd);
|
||||
var fixture = body.createFixture(fd);
|
||||
if ( fixtureJson.name )
|
||||
fixture.name = fixtureJson.name;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue