matrix-engine-wgpu 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * npm import/export
5
5
  */
6
6
  // import {degToRad, radToDeg} from "./utils";
7
- import {downloadMeshes} from "./src/engine/loader-obj.js";
7
+ import {downloadMeshes, makeObjSeqArg} from "./src/engine/loader-obj.js";
8
8
  import MatrixEngineWGPU from "./src/world.js";
9
9
  import {
10
10
  addRaycastsAABBListener,
@@ -36,5 +36,6 @@ export {
36
36
  rayIntersectsAABB,
37
37
  computeAABB,
38
38
  computeWorldVertsAndAABB,
39
+ makeObjSeqArg,
39
40
  about
40
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matrix-engine-wgpu",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "obj sequence anim +HOTFIX raycast, webGPU powered pwa application. Crazy fast rendering with AmmoJS physics support. Simple raycaster hit object added.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -68,8 +68,14 @@ export default class MatrixAmmo {
68
68
  }
69
69
 
70
70
  addPhysicsSphere(MEObject, pOptions) {
71
+ const FLAGS = {
72
+ TEST_NIDZA: 3,
73
+ CF_KINEMATIC_OBJECT: 2
74
+ }
75
+
71
76
  let Ammo = this.Ammo;
72
- var colShape = new Ammo.btSphereShape(pOptions.radius),
77
+ console.log(pOptions.radius + "<<pOptions.radius")
78
+ var colShape = new Ammo.btSphereShape(Array.isArray(pOptions.radius) ? pOptions.radius[0] : pOptions.radius),
73
79
  startTransform = new Ammo.btTransform();
74
80
  startTransform.setIdentity();
75
81
  var mass = 1;
@@ -81,6 +87,20 @@ export default class MatrixAmmo {
81
87
  rbInfo = new Ammo.btRigidBodyConstructionInfo(mass, myMotionState, colShape, localInertia),
82
88
  body = new Ammo.btRigidBody(rbInfo);
83
89
 
90
+ if(pOptions.mass == 0 && typeof pOptions.state == 'undefined' && typeof pOptions.collide == 'undefined') {
91
+ body.setActivationState(2)
92
+ body.setCollisionFlags(FLAGS.CF_KINEMATIC_OBJECT);
93
+ // console.log('what is pOptions.mass and state is 2 ....', pOptions.mass)
94
+ } else if(typeof pOptions.collide != 'undefined' && pOptions.collide == false) {
95
+ // idea not work for now - eliminate collide effect
96
+ body.setActivationState(4)
97
+ body.setCollisionFlags(FLAGS.TEST_NIDZA);
98
+ } else {
99
+ body.setActivationState(4)
100
+ }
101
+
102
+ body.name = pOptions.name;
103
+ MEObject.itIsPhysicsBody = true;
84
104
  body.MEObject = MEObject;
85
105
  this.dynamicsWorld.addRigidBody(body);
86
106
  this.rigidBodies.push(body);