chuck.js/app/Game/Core/GameObjects/SpectatorDoll.js
Karl Pannek dc779def9c 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
2025-07-16 15:01:59 +02:00

42 lines
No EOL
988 B
JavaScript

define([
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
"Lib/Vendor/Planck"
],
function (Parent, Box2D) {
"use strict";
function SpectatorDoll(physicsEngine, uid, player) {
//Parent.call(this, physicsEngine, uid);
}
SpectatorDoll.prototype = Object.create(Parent.prototype);
SpectatorDoll.prototype.getBodyDef = function() {
var bodyDef = { type: 'static', position: planck.Vec2(0, 0), angle: 0 };
bodyDef.type = 'dynamic';
bodyDef.position.x = this.getPosition().x;
bodyDef.position.y = this.getPosition().y;
bodyDef.angle = 0;
return bodyDef;
};
SpectatorDoll.prototype.getPosition = function() {
return {x: 10, y: 10};
}
SpectatorDoll.prototype.getHeadPosition = function() {
return {x: 10, y: 10};
}
SpectatorDoll.prototype.update = function() {
};
SpectatorDoll.prototype.destroy = function() {
};
return SpectatorDoll;
});