@galacean/engine-physics-physx 1.1.0-beta.6 → 1.1.0-beta.8
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/dist/browser.js +26 -25
- package/dist/browser.min.js +1 -1
- package/dist/main.js +26 -25
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +26 -25
- package/dist/module.js +26 -25
- package/dist/module.js.map +1 -1
- package/libs/physx.release.js +1 -1
- package/libs/physx.release.js.js +31 -31
- package/libs/physx.release.wasm +0 -0
- package/package.json +4 -4
- package/types/PhysXCharacterController.d.ts +3 -2
- package/types/joint/PhysXHingeJoint.d.ts +2 -3
- package/libs/physx.release.js.mem +0 -0
package/dist/miniprogram.js
CHANGED
|
@@ -94,7 +94,6 @@ var ShapeFlag;
|
|
|
94
94
|
this._axis = null;
|
|
95
95
|
this._physXRotation = new miniprogram.Quaternion();
|
|
96
96
|
this._shapeFlags = 2 | 1;
|
|
97
|
-
/** @internal */ this._pxMaterials = new Array(1);
|
|
98
97
|
this._physXPhysics = physXPhysics;
|
|
99
98
|
}
|
|
100
99
|
var _proto = PhysXColliderShape.prototype;
|
|
@@ -115,7 +114,7 @@ var ShapeFlag;
|
|
|
115
114
|
}
|
|
116
115
|
var controllers = this._controllers;
|
|
117
116
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
118
|
-
controllers.get(i).
|
|
117
|
+
controllers.get(i)._updateShapePosition(this._position, this._worldScale);
|
|
119
118
|
}
|
|
120
119
|
this._setLocalPose();
|
|
121
120
|
};
|
|
@@ -126,7 +125,7 @@ var ShapeFlag;
|
|
|
126
125
|
this._setLocalPose();
|
|
127
126
|
var controllers = this._controllers;
|
|
128
127
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
129
|
-
controllers.get(i).
|
|
128
|
+
controllers.get(i)._updateShapePosition(this._position, this._worldScale);
|
|
130
129
|
}
|
|
131
130
|
};
|
|
132
131
|
/**
|
|
@@ -142,8 +141,8 @@ var ShapeFlag;
|
|
|
142
141
|
/**
|
|
143
142
|
* {@inheritDoc IColliderShape.setMaterial }
|
|
144
143
|
*/ _proto.setMaterial = function setMaterial(value) {
|
|
145
|
-
this.
|
|
146
|
-
this._pxShape.
|
|
144
|
+
this._pxMaterial = value._pxMaterial;
|
|
145
|
+
this._pxShape.setMaterial(this._pxMaterial);
|
|
147
146
|
};
|
|
148
147
|
/**
|
|
149
148
|
* {@inheritDoc IColliderShape.setIsTrigger }
|
|
@@ -171,7 +170,7 @@ var ShapeFlag;
|
|
|
171
170
|
};
|
|
172
171
|
_proto._initialize = function _initialize(material, id) {
|
|
173
172
|
this._id = id;
|
|
174
|
-
this.
|
|
173
|
+
this._pxMaterial = material._pxMaterial;
|
|
175
174
|
this._pxShape = this._physXPhysics._pxPhysics.createShape(this._pxGeometry, material._pxMaterial, true, new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags));
|
|
176
175
|
this._pxShape.setUUID(id);
|
|
177
176
|
};
|
|
@@ -370,8 +369,8 @@ var /**
|
|
|
370
369
|
* Base class for character controllers.
|
|
371
370
|
*/ var PhysXCharacterController = /*#__PURE__*/ function() {
|
|
372
371
|
function PhysXCharacterController(physXPhysics) {
|
|
373
|
-
this.
|
|
374
|
-
this.
|
|
372
|
+
this._shapeScaledPosition = new miniprogram.Vector3();
|
|
373
|
+
this._worldPosition = null;
|
|
375
374
|
this._physXPhysics = physXPhysics;
|
|
376
375
|
}
|
|
377
376
|
var _proto = PhysXCharacterController.prototype;
|
|
@@ -385,18 +384,15 @@ var /**
|
|
|
385
384
|
/**
|
|
386
385
|
* {@inheritDoc ICharacterController.setWorldPosition }
|
|
387
386
|
*/ _proto.setWorldPosition = function setWorldPosition(position) {
|
|
388
|
-
this.
|
|
389
|
-
|
|
390
|
-
miniprogram.Vector3.add(position, this._scaledOffset, PhysXCharacterController._tempVec);
|
|
391
|
-
this._pxController.setPosition(PhysXCharacterController._tempVec);
|
|
392
|
-
}
|
|
387
|
+
this._worldPosition = position;
|
|
388
|
+
this._updateNativePosition();
|
|
393
389
|
};
|
|
394
390
|
/**
|
|
395
391
|
* {@inheritDoc ICharacterController.getWorldPosition }
|
|
396
392
|
*/ _proto.getWorldPosition = function getWorldPosition(position) {
|
|
397
393
|
if (this._pxController) {
|
|
398
394
|
position.copyFrom(this._pxController.getPosition());
|
|
399
|
-
position.subtract(this.
|
|
395
|
+
position.subtract(this._shapeScaledPosition);
|
|
400
396
|
}
|
|
401
397
|
};
|
|
402
398
|
/**
|
|
@@ -459,7 +455,7 @@ var /**
|
|
|
459
455
|
} else {
|
|
460
456
|
throw "unsupported shape type";
|
|
461
457
|
}
|
|
462
|
-
desc.setMaterial(shape.
|
|
458
|
+
desc.setMaterial(shape._pxMaterial);
|
|
463
459
|
this._pxController = pxManager._getControllerManager().createController(desc);
|
|
464
460
|
this._pxController.setUUID(shape._id);
|
|
465
461
|
};
|
|
@@ -473,9 +469,16 @@ var /**
|
|
|
473
469
|
};
|
|
474
470
|
/**
|
|
475
471
|
* @internal
|
|
476
|
-
*/ _proto.
|
|
477
|
-
miniprogram.Vector3.multiply(
|
|
478
|
-
this.
|
|
472
|
+
*/ _proto._updateShapePosition = function _updateShapePosition(shapePosition, worldScale) {
|
|
473
|
+
miniprogram.Vector3.multiply(shapePosition, worldScale, this._shapeScaledPosition);
|
|
474
|
+
this._updateNativePosition();
|
|
475
|
+
};
|
|
476
|
+
_proto._updateNativePosition = function _updateNativePosition() {
|
|
477
|
+
var worldPosition = this._worldPosition;
|
|
478
|
+
if (this._pxController && worldPosition) {
|
|
479
|
+
miniprogram.Vector3.add(worldPosition, this._shapeScaledPosition, PhysXCharacterController._tempVec);
|
|
480
|
+
this._pxController.setPosition(PhysXCharacterController._tempVec);
|
|
481
|
+
}
|
|
479
482
|
};
|
|
480
483
|
return PhysXCharacterController;
|
|
481
484
|
}();
|
|
@@ -1094,7 +1097,6 @@ var /**
|
|
|
1094
1097
|
_this = PhysXJoint1.call(this, physXPhysics) || this;
|
|
1095
1098
|
_this._axisRotationQuaternion = new miniprogram.Quaternion();
|
|
1096
1099
|
_this._swingOffset = new miniprogram.Vector3();
|
|
1097
|
-
_this._velocity = new miniprogram.Vector3();
|
|
1098
1100
|
_this._collider = collider;
|
|
1099
1101
|
_this._pxJoint = physXPhysics._pxPhysics.createRevoluteJoint(null, PhysXJoint._defaultVec, PhysXJoint._defaultQuat, collider._pxActor, PhysXJoint._defaultVec, PhysXJoint._defaultQuat);
|
|
1100
1102
|
return _this;
|
|
@@ -1126,9 +1128,7 @@ var /**
|
|
|
1126
1128
|
/**
|
|
1127
1129
|
* {@inheritDoc IHingeJoint.getVelocity }
|
|
1128
1130
|
*/ _proto.getVelocity = function getVelocity() {
|
|
1129
|
-
|
|
1130
|
-
velocity.copyFrom(this._pxJoint.getVelocity());
|
|
1131
|
-
return velocity;
|
|
1131
|
+
return this._pxJoint.getVelocity();
|
|
1132
1132
|
};
|
|
1133
1133
|
/**
|
|
1134
1134
|
* {@inheritDoc IHingeJoint.setHardLimitCone }
|
|
@@ -1142,8 +1142,9 @@ var /**
|
|
|
1142
1142
|
};
|
|
1143
1143
|
/**
|
|
1144
1144
|
* {@inheritDoc IHingeJoint.setDriveVelocity }
|
|
1145
|
-
*/ _proto.setDriveVelocity = function setDriveVelocity(velocity) {
|
|
1146
|
-
|
|
1145
|
+
*/ _proto.setDriveVelocity = function setDriveVelocity(velocity, autowake) {
|
|
1146
|
+
if (autowake === void 0) autowake = true;
|
|
1147
|
+
this._pxJoint.setDriveVelocity(velocity, autowake);
|
|
1147
1148
|
};
|
|
1148
1149
|
/**
|
|
1149
1150
|
* {@inheritDoc IHingeJoint.setDriveForceLimit }
|
|
@@ -1423,7 +1424,7 @@ var InitializeState;
|
|
|
1423
1424
|
})(InitializeState || (InitializeState = {}));
|
|
1424
1425
|
|
|
1425
1426
|
//@ts-ignore
|
|
1426
|
-
var version = "1.1.0-beta.
|
|
1427
|
+
var version = "1.1.0-beta.8";
|
|
1427
1428
|
console.log("Galacean PhysX version: " + version);
|
|
1428
1429
|
|
|
1429
1430
|
exports.PhysXPhysics = PhysXPhysics;
|
package/dist/module.js
CHANGED
|
@@ -89,7 +89,6 @@ var ShapeFlag;
|
|
|
89
89
|
this._axis = null;
|
|
90
90
|
this._physXRotation = new Quaternion();
|
|
91
91
|
this._shapeFlags = 2 | 1;
|
|
92
|
-
/** @internal */ this._pxMaterials = new Array(1);
|
|
93
92
|
this._physXPhysics = physXPhysics;
|
|
94
93
|
}
|
|
95
94
|
var _proto = PhysXColliderShape.prototype;
|
|
@@ -110,7 +109,7 @@ var ShapeFlag;
|
|
|
110
109
|
}
|
|
111
110
|
var controllers = this._controllers;
|
|
112
111
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
113
|
-
controllers.get(i).
|
|
112
|
+
controllers.get(i)._updateShapePosition(this._position, this._worldScale);
|
|
114
113
|
}
|
|
115
114
|
this._setLocalPose();
|
|
116
115
|
};
|
|
@@ -121,7 +120,7 @@ var ShapeFlag;
|
|
|
121
120
|
this._setLocalPose();
|
|
122
121
|
var controllers = this._controllers;
|
|
123
122
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
124
|
-
controllers.get(i).
|
|
123
|
+
controllers.get(i)._updateShapePosition(this._position, this._worldScale);
|
|
125
124
|
}
|
|
126
125
|
};
|
|
127
126
|
/**
|
|
@@ -137,8 +136,8 @@ var ShapeFlag;
|
|
|
137
136
|
/**
|
|
138
137
|
* {@inheritDoc IColliderShape.setMaterial }
|
|
139
138
|
*/ _proto.setMaterial = function setMaterial(value) {
|
|
140
|
-
this.
|
|
141
|
-
this._pxShape.
|
|
139
|
+
this._pxMaterial = value._pxMaterial;
|
|
140
|
+
this._pxShape.setMaterial(this._pxMaterial);
|
|
142
141
|
};
|
|
143
142
|
/**
|
|
144
143
|
* {@inheritDoc IColliderShape.setIsTrigger }
|
|
@@ -166,7 +165,7 @@ var ShapeFlag;
|
|
|
166
165
|
};
|
|
167
166
|
_proto._initialize = function _initialize(material, id) {
|
|
168
167
|
this._id = id;
|
|
169
|
-
this.
|
|
168
|
+
this._pxMaterial = material._pxMaterial;
|
|
170
169
|
this._pxShape = this._physXPhysics._pxPhysics.createShape(this._pxGeometry, material._pxMaterial, true, new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags));
|
|
171
170
|
this._pxShape.setUUID(id);
|
|
172
171
|
};
|
|
@@ -365,8 +364,8 @@ var /**
|
|
|
365
364
|
* Base class for character controllers.
|
|
366
365
|
*/ var PhysXCharacterController = /*#__PURE__*/ function() {
|
|
367
366
|
function PhysXCharacterController(physXPhysics) {
|
|
368
|
-
this.
|
|
369
|
-
this.
|
|
367
|
+
this._shapeScaledPosition = new Vector3();
|
|
368
|
+
this._worldPosition = null;
|
|
370
369
|
this._physXPhysics = physXPhysics;
|
|
371
370
|
}
|
|
372
371
|
var _proto = PhysXCharacterController.prototype;
|
|
@@ -380,18 +379,15 @@ var /**
|
|
|
380
379
|
/**
|
|
381
380
|
* {@inheritDoc ICharacterController.setWorldPosition }
|
|
382
381
|
*/ _proto.setWorldPosition = function setWorldPosition(position) {
|
|
383
|
-
this.
|
|
384
|
-
|
|
385
|
-
Vector3.add(position, this._scaledOffset, PhysXCharacterController._tempVec);
|
|
386
|
-
this._pxController.setPosition(PhysXCharacterController._tempVec);
|
|
387
|
-
}
|
|
382
|
+
this._worldPosition = position;
|
|
383
|
+
this._updateNativePosition();
|
|
388
384
|
};
|
|
389
385
|
/**
|
|
390
386
|
* {@inheritDoc ICharacterController.getWorldPosition }
|
|
391
387
|
*/ _proto.getWorldPosition = function getWorldPosition(position) {
|
|
392
388
|
if (this._pxController) {
|
|
393
389
|
position.copyFrom(this._pxController.getPosition());
|
|
394
|
-
position.subtract(this.
|
|
390
|
+
position.subtract(this._shapeScaledPosition);
|
|
395
391
|
}
|
|
396
392
|
};
|
|
397
393
|
/**
|
|
@@ -454,7 +450,7 @@ var /**
|
|
|
454
450
|
} else {
|
|
455
451
|
throw "unsupported shape type";
|
|
456
452
|
}
|
|
457
|
-
desc.setMaterial(shape.
|
|
453
|
+
desc.setMaterial(shape._pxMaterial);
|
|
458
454
|
this._pxController = pxManager._getControllerManager().createController(desc);
|
|
459
455
|
this._pxController.setUUID(shape._id);
|
|
460
456
|
};
|
|
@@ -468,9 +464,16 @@ var /**
|
|
|
468
464
|
};
|
|
469
465
|
/**
|
|
470
466
|
* @internal
|
|
471
|
-
*/ _proto.
|
|
472
|
-
Vector3.multiply(
|
|
473
|
-
this.
|
|
467
|
+
*/ _proto._updateShapePosition = function _updateShapePosition(shapePosition, worldScale) {
|
|
468
|
+
Vector3.multiply(shapePosition, worldScale, this._shapeScaledPosition);
|
|
469
|
+
this._updateNativePosition();
|
|
470
|
+
};
|
|
471
|
+
_proto._updateNativePosition = function _updateNativePosition() {
|
|
472
|
+
var worldPosition = this._worldPosition;
|
|
473
|
+
if (this._pxController && worldPosition) {
|
|
474
|
+
Vector3.add(worldPosition, this._shapeScaledPosition, PhysXCharacterController._tempVec);
|
|
475
|
+
this._pxController.setPosition(PhysXCharacterController._tempVec);
|
|
476
|
+
}
|
|
474
477
|
};
|
|
475
478
|
return PhysXCharacterController;
|
|
476
479
|
}();
|
|
@@ -1089,7 +1092,6 @@ var /**
|
|
|
1089
1092
|
_this = PhysXJoint1.call(this, physXPhysics) || this;
|
|
1090
1093
|
_this._axisRotationQuaternion = new Quaternion();
|
|
1091
1094
|
_this._swingOffset = new Vector3();
|
|
1092
|
-
_this._velocity = new Vector3();
|
|
1093
1095
|
_this._collider = collider;
|
|
1094
1096
|
_this._pxJoint = physXPhysics._pxPhysics.createRevoluteJoint(null, PhysXJoint._defaultVec, PhysXJoint._defaultQuat, collider._pxActor, PhysXJoint._defaultVec, PhysXJoint._defaultQuat);
|
|
1095
1097
|
return _this;
|
|
@@ -1121,9 +1123,7 @@ var /**
|
|
|
1121
1123
|
/**
|
|
1122
1124
|
* {@inheritDoc IHingeJoint.getVelocity }
|
|
1123
1125
|
*/ _proto.getVelocity = function getVelocity() {
|
|
1124
|
-
|
|
1125
|
-
velocity.copyFrom(this._pxJoint.getVelocity());
|
|
1126
|
-
return velocity;
|
|
1126
|
+
return this._pxJoint.getVelocity();
|
|
1127
1127
|
};
|
|
1128
1128
|
/**
|
|
1129
1129
|
* {@inheritDoc IHingeJoint.setHardLimitCone }
|
|
@@ -1137,8 +1137,9 @@ var /**
|
|
|
1137
1137
|
};
|
|
1138
1138
|
/**
|
|
1139
1139
|
* {@inheritDoc IHingeJoint.setDriveVelocity }
|
|
1140
|
-
*/ _proto.setDriveVelocity = function setDriveVelocity(velocity) {
|
|
1141
|
-
|
|
1140
|
+
*/ _proto.setDriveVelocity = function setDriveVelocity(velocity, autowake) {
|
|
1141
|
+
if (autowake === void 0) autowake = true;
|
|
1142
|
+
this._pxJoint.setDriveVelocity(velocity, autowake);
|
|
1142
1143
|
};
|
|
1143
1144
|
/**
|
|
1144
1145
|
* {@inheritDoc IHingeJoint.setDriveForceLimit }
|
|
@@ -1418,7 +1419,7 @@ var InitializeState;
|
|
|
1418
1419
|
})(InitializeState || (InitializeState = {}));
|
|
1419
1420
|
|
|
1420
1421
|
//@ts-ignore
|
|
1421
|
-
var version = "1.1.0-beta.
|
|
1422
|
+
var version = "1.1.0-beta.8";
|
|
1422
1423
|
console.log("Galacean PhysX version: " + version);
|
|
1423
1424
|
|
|
1424
1425
|
export { PhysXPhysics, PhysXRuntimeMode, version };
|