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
|
|
@ -2,13 +2,13 @@ define([
|
|||
"Game/Core/Physics/Engine",
|
||||
"Game/Config/Settings",
|
||||
"Game/Client/View/DomController",
|
||||
"Lib/Vendor/Box2D",
|
||||
"Lib/Vendor/Planck",
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Game/Client/View/Pixi/DebugDraw",
|
||||
"Game/Client/View/Pixi/PlanckDebugDraw",
|
||||
"Game/Client/View/Pixi/Layers/Debug"
|
||||
],
|
||||
|
||||
function (Parent, Settings, domController, Box2D, nc, DebugDraw, debugLayer) {
|
||||
function (Parent, Settings, domController, Box2D, nc, PlanckDebugDraw, debugLayer) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
@ -34,25 +34,26 @@ function (Parent, Settings, domController, Box2D, nc, DebugDraw, debugLayer) {
|
|||
|
||||
Engine.prototype.setupDebugDraw = function () {
|
||||
|
||||
// set debug draw
|
||||
this.debugDraw = new DebugDraw();
|
||||
// set debug draw for Planck.js
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
canvas.style.position = 'absolute';
|
||||
canvas.style.top = '0';
|
||||
canvas.style.left = '0';
|
||||
canvas.style.pointerEvents = 'none';
|
||||
canvas.style.zIndex = '1000';
|
||||
document.body.appendChild(canvas);
|
||||
|
||||
this.debugDraw = new PlanckDebugDraw(canvas);
|
||||
this.debugCanvas = canvas;
|
||||
};
|
||||
|
||||
this.debugDraw.SetSprite(debugLayer.graphics);
|
||||
this.debugDraw.SetDrawScale(Settings.RATIO);
|
||||
this.debugDraw.SetFillAlpha(0.5);
|
||||
this.debugDraw.SetLineThickness(1.0);
|
||||
|
||||
this.debugDraw.SetFlags(null
|
||||
| Box2D.Dynamics.b2DebugDraw.e_shapeBit
|
||||
| Box2D.Dynamics.b2DebugDraw.e_jointBit
|
||||
//| Box2D.Dynamics.b2DebugDraw.e_coreShapeBit
|
||||
//| Box2D.Dynamics.b2DebugDraw.e_aabbBit
|
||||
//| Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit
|
||||
//| Box2D.Dynamics.b2DebugDraw.e_obbBit
|
||||
//| Box2D.Dynamics.b2DebugDraw.e_pairBit
|
||||
);
|
||||
|
||||
this.world.SetDebugDraw(this.debugDraw);
|
||||
Engine.prototype.renderDebug = function () {
|
||||
if (this.debugDraw) {
|
||||
this.debugDraw.clear();
|
||||
this.debugDraw.drawWorld(this.world);
|
||||
}
|
||||
};
|
||||
|
||||
Engine.prototype.update = function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue