Fix Planck.js migration issues and restore RubeDoll functionality

- Fixed Mat22.fromAngle -> Rot.rot() error in RubeDoll.js
- Fixed rot.mul() -> Rot.mul(rot, v) static method usage
- Restored RubeLoader imports and RubeDoll.json loading
- Migrated RubeLoader.js from Box2D to Planck.js API
- Updated all Box2D method calls to Planck.js equivalents
- Fixed import aliases from Box2D to planck across multiple files
- RubeDoll ragdolls now spawn correctly when players die
This commit is contained in:
Karl Pannek 2025-07-18 22:27:42 +02:00
parent 162a4ab82d
commit 9f92f024b1

View file

@ -147,14 +147,14 @@ function (Parent, RubeLoader, planck, Settings, Assert, nc, Matrix, RubeDollJson
// grabing local point to "rotate" around (x, y position transform only) // grabing local point to "rotate" around (x, y position transform only)
var localPoint = this.body.getLocalPoint(limb.getPosition().clone()); var localPoint = this.body.getLocalPoint(limb.getPosition().clone());
// create rotation matrix from chest rotation difference // create rotation from chest rotation difference
var mat = planck.Mat22.fromAngle(differenceAngle); var rot = planck.Rot(differenceAngle);
// matrix multiplication with local limb position // rotate the local point using static method
position = mat.mulTV(localPoint); var rotatedPoint = planck.Rot.mul(rot, localPoint);
// translating back to global position // translating back to global position
var globalPoint = this.body.getWorldPoint(position); var globalPoint = this.body.getWorldPoint(rotatedPoint);
limb.setPosition(globalPoint); limb.setPosition(globalPoint);
// relative limb rotating by chest rotation difference // relative limb rotating by chest rotation difference