UNPKG

@osobh/reactar

Version:

AR Library for React Native and Expo

76 lines (75 loc) 2.37 kB
console.log('Mock for ammojs3 loaded'); module.exports = () => Promise.resolve({ btDefaultCollisionConfiguration: function () { return {}; }, btCollisionDispatcher: function () { return {}; }, btDbvtBroadphase: function () { return {}; }, btSequentialImpulseConstraintSolver: function () { return {}; }, btDiscreteDynamicsWorld: function () { this.stepSimulation = jest.fn(); this.addRigidBody = jest.fn(); this.removeRigidBody = jest.fn(); this.setGravity = jest.fn(); return this; }, btTransform: function () { this.setIdentity = jest.fn(); this.setOrigin = jest.fn(); this.setRotation = jest.fn(); this.getOrigin = jest.fn(() => ({ x: () => 0, y: () => 0, z: () => 0 })); this.getRotation = jest.fn(() => ({ x: () => 0, y: () => 0, z: () => 0, w: () => 1 })); return this; }, btVector3: function (x, y, z) { this.x = jest.fn(() => x); this.y = jest.fn(() => y); this.z = jest.fn(() => z); return this; }, btQuaternion: function (x, y, z, w) { this.x = jest.fn(() => x); this.y = jest.fn(() => y); this.z = jest.fn(() => z); this.w = jest.fn(() => w); return this; }, btDefaultMotionState: function () { this.getWorldTransform = jest.fn((transform) => transform); return this; }, btBoxShape: function () { this.calculateLocalInertia = jest.fn(); return this; }, btRigidBodyConstructionInfo: function () { return this; }, btRigidBody: function () { this.setMass = jest.fn(); this.applyCentralForce = jest.fn(); this.applyForce = jest.fn(); this.getMotionState = jest.fn(() => ({ getWorldTransform: jest.fn((transform) => transform), // Fixed: ':' instead of '=' })); this.setFriction = jest.fn(); this.setRestitution = jest.fn(); this.setDamping = jest.fn(); this.setCollisionFlags = jest.fn(); this.getWorldTransform = jest.fn(() => ({ setOrigin: jest.fn(), setRotation: jest.fn(), getOrigin: jest.fn(() => ({ x: () => 0, y: () => 0, z: () => 0 })), getRotation: jest.fn(() => ({ x: () => 0, y: () => 0, z: () => 0, w: () => 1 })), })); return this; }, destroy: jest.fn(), });