UNPKG

lingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

29 lines 1.26 kB
import { getAppendablesById } from "../../collections/idCollections"; import { point2Vec } from "../../display/utils/vec2Point"; import getActualScale from "../../memo/getActualScale"; import getCenter from "../../memo/getCenter"; import getWorldQuaternion from "../../memo/getWorldQuaternion"; import { configPhysicsSystem } from "./configPhysicsSystem"; import { createLoadedEffectSystem } from "../utils/createLoadedEffectSystem"; export const placeAtSystem = createLoadedEffectSystem("placeAtSystem", { data: {}, effect: (self, { target }) => { if (typeof target === "string") { const [found] = getAppendablesById(target); if (!("outerObject3d" in found)) return; target = found; } if ("outerObject3d" in target) { if ("isSpawnPoint" in target) target.object3d.position.y = getActualScale(self).y * 0.5; self.position.copy(getCenter(target.object3d)); "quaternion" in self && self.quaternion.copy(getWorldQuaternion(target.outerObject3d)); } else self.position.copy(point2Vec(target)); configPhysicsSystem.add(self); } }); //# sourceMappingURL=placeAtSystem.js.map