Skip to content

Commit

Permalink
fix(map): correct rotation of doodads when placing on map
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Jan 4, 2024
1 parent 47b1890 commit da74d4b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
16 changes: 11 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"three.js"
],
"dependencies": {
"@wowserhq/format": "^0.10.1"
"@wowserhq/format": "^0.10.2"
},
"peerDependencies": {
"three": "^0.160.0"
Expand Down
12 changes: 2 additions & 10 deletions src/lib/map/DoodadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import ModelManager from '../model/ModelManager.js';
import FormatManager from '../FormatManager.js';
import TextureManager from '../texture/TextureManager.js';

const DEG2RAD = Math.PI / 180;

class DoodadManager {
#modelManager: ModelManager;

Expand All @@ -27,14 +25,8 @@ class DoodadManager {
const model = doodadModels[i];
const def = doodadDefs[i];

model.position.set(def.mapPosition[0], def.mapPosition[1], def.mapPosition[2]);

// Def rotation is in degrees
model.rotation.set(
def.mapRotation[0] * DEG2RAD,
def.mapRotation[1] * DEG2RAD,
def.mapRotation[2] * DEG2RAD,
);
model.position.set(def.position[0], def.position[1], def.position[2]);
model.quaternion.set(def.rotation[0], def.rotation[1], def.rotation[2], def.rotation[3]);

// Def scale is on all axes and is a fixed precision value
model.scale.setScalar(def.scale / 1024);
Expand Down

0 comments on commit da74d4b

Please sign in to comment.