lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
26 lines • 1.32 kB
JavaScript
import { managerControllerMap } from "../../collections/pxCollections";
import { assignPxExtendedVec, assignPxTransform, setPxVec } from "../../engine/physx/pxMath";
import { dtPtr } from "../../pointers/dtPtr";
import { physxLoopPtr } from "../../pointers/physxLoopPtr";
import { physxPtr } from "../../pointers/physxPtr";
import createInternalSystem from "../utils/createInternalSystem";
export const configPhysicsTransformSystem = createInternalSystem("configPhysicsTransformSystem", {
effect: (self) => {
const controller = managerControllerMap.get(self);
if (controller) {
if (physxLoopPtr[0]) {
const { x: px, y: py, z: pz } = self.position;
const { x: cx, y: cy, z: cz } = controller.getPosition();
controller.move(setPxVec(px - cx, py - cy, pz - cz), 0.001, dtPtr[0], physxPtr[0].pxControllerFilters);
return;
}
controller.setPosition(assignPxExtendedVec(self.position));
}
self.$actor.setGlobalPose(assignPxTransform(self));
if (!("setLinearVelocity" in self.$actor))
return;
self.$actor.setLinearVelocity(setPxVec(0, 0, 0));
self.$actor.setAngularVelocity(setPxVec(0, 0, 0));
}
});
//# sourceMappingURL=configPhysicsTransformSystem.js.map