mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
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:
parent
162a4ab82d
commit
9f92f024b1
1 changed files with 5 additions and 5 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue