mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
- 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
39 lines
No EOL
877 B
JavaScript
Executable file
39 lines
No EOL
877 B
JavaScript
Executable file
define([
|
|
"Game/Core/GameObjects/GameObject",
|
|
"Lib/Vendor/Planck"
|
|
],
|
|
|
|
function (Parent, Box2D) {
|
|
|
|
"use strict";
|
|
|
|
function GameObject(physicsEngine, uid) {
|
|
Parent.call(this, physicsEngine, uid);
|
|
}
|
|
|
|
GameObject.prototype = Object.create(Parent.prototype);
|
|
|
|
GameObject.prototype.getUpdateData = function(getSleeping) {
|
|
|
|
if (!this.body) {
|
|
return null;
|
|
}
|
|
|
|
if (this.body.getType() === 'static') {
|
|
return null;
|
|
}
|
|
|
|
if (!getSleeping && !this.body.isAwake()) {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
p: this.body.getPosition(),
|
|
a: this.body.getAngle(),
|
|
lv: this.body.getLinearVelocity(),
|
|
av: this.body.getAngularVelocity()
|
|
};
|
|
}
|
|
|
|
return GameObject;
|
|
}); |