lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
81 lines • 2.4 kB
JavaScript
import { Object3D } from "three";
import { deg2Rad, rad2Deg } from "@lincode/math";
import { setManager } from "./utils/getManager";
import { CM2M, M2CM } from "../../globals";
import SimpleObjectManager from "./SimpleObjectManager";
import { configPhysicsSystem } from "../../systems/configLoadedSystems/configPhysicsSystem";
export default class ObjectManager extends SimpleObjectManager {
constructor(object3d = new Object3D()) {
super(new Object3D());
this.object3d = object3d;
setManager(object3d, this);
this.outerObject3d.add(object3d);
}
get innerRotationX() {
return this.object3d.rotation.x * rad2Deg;
}
set innerRotationX(val) {
this.object3d.rotation.x = val * deg2Rad;
}
get innerRotationY() {
return this.object3d.rotation.y * rad2Deg;
}
set innerRotationY(val) {
this.object3d.rotation.y = val * deg2Rad;
}
get innerRotationZ() {
return this.object3d.rotation.z * rad2Deg;
}
set innerRotationZ(val) {
this.object3d.rotation.z = val * deg2Rad;
}
get innerRotation() {
return this.innerRotationZ;
}
set innerRotation(val) {
this.innerRotationZ = val;
}
get innerX() {
return this.object3d.position.x * M2CM;
}
set innerX(val) {
this.object3d.position.x = val * CM2M;
}
get innerY() {
return this.object3d.position.y * M2CM;
}
set innerY(val) {
this.object3d.position.y = val * CM2M;
}
get innerZ() {
return this.object3d.position.z * M2CM;
}
set innerZ(val) {
this.object3d.position.z = val * CM2M;
}
get width() {
return this.object3d.scale.x * M2CM;
}
set width(val) {
this.object3d.scale.x = val * CM2M;
this.userData.physicsMode = undefined;
configPhysicsSystem.add(this);
}
get height() {
return this.object3d.scale.y * M2CM;
}
set height(val) {
this.object3d.scale.y = val * CM2M;
this.userData.physicsMode = undefined;
configPhysicsSystem.add(this);
}
get depth() {
return this.object3d.scale.z * M2CM;
}
set depth(val) {
this.object3d.scale.z = val * CM2M;
this.userData.physicsMode = undefined;
configPhysicsSystem.add(this);
}
}
//# sourceMappingURL=ObjectManager.js.map