matrix-engine-wgpu 1.2.10 → 1.2.11
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/package.json +1 -1
- package/src/physics/matrix-ammo.js +23 -0
- package/src/world.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matrix-engine-wgpu",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"description": "+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": [
|
|
@@ -196,6 +196,29 @@ export default class MatrixAmmo {
|
|
|
196
196
|
return b;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
deactivatePhysics(body) {
|
|
200
|
+
const CF_KINEMATIC_OBJECT = 2;
|
|
201
|
+
const DISABLE_DEACTIVATION = 4;
|
|
202
|
+
// 1. Remove from world
|
|
203
|
+
this.dynamicsWorld.removeRigidBody(body);
|
|
204
|
+
// 2. Set body to kinematic
|
|
205
|
+
const flags = body.getCollisionFlags();
|
|
206
|
+
body.setCollisionFlags(flags | CF_KINEMATIC_OBJECT);
|
|
207
|
+
body.setActivationState(DISABLE_DEACTIVATION); // no auto-wakeup
|
|
208
|
+
// 3. Clear motion
|
|
209
|
+
const zero = new Ammo.btVector3(0, 0, 0);
|
|
210
|
+
body.setLinearVelocity(zero);
|
|
211
|
+
body.setAngularVelocity(zero);
|
|
212
|
+
// 4. Reset transform to current position (optional — preserves pose)
|
|
213
|
+
const currentTransform = body.getWorldTransform();
|
|
214
|
+
body.setWorldTransform(currentTransform);
|
|
215
|
+
body.getMotionState().setWorldTransform(currentTransform);
|
|
216
|
+
// 5. Add back to physics world
|
|
217
|
+
this.matrixAmmo.dynamicsWorld.addRigidBody(body);
|
|
218
|
+
// 6. Mark it manually (logic flag)
|
|
219
|
+
body.isKinematic = true;
|
|
220
|
+
}
|
|
221
|
+
|
|
199
222
|
detectCollision() {
|
|
200
223
|
console.log('override this')
|
|
201
224
|
return;
|
package/src/world.js
CHANGED
|
@@ -282,8 +282,6 @@ export default class MatrixEngineWGPU {
|
|
|
282
282
|
if(typeof o.physics.name === 'undefined') {o.physics.name = o.name;}
|
|
283
283
|
if(typeof o.physics.scale === 'undefined') {o.physics.scale = o.scale;}
|
|
284
284
|
if(typeof o.physics.rotation === 'undefined') {o.physics.rotation = o.rotation;}
|
|
285
|
-
|
|
286
|
-
// send same pos
|
|
287
285
|
o.physics.position = o.position;
|
|
288
286
|
// console.log('Mesh procedure', o)
|
|
289
287
|
let myMesh1 = new MEMeshObj(this.canvas, this.device, this.context, o)
|