@babylonjs/core 7.51.0 → 7.51.1
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/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Meshes/geometry.js +1 -2
- package/Meshes/geometry.js.map +1 -1
- package/Misc/sceneOptimizer.js +1 -0
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +4 -2
- package/Misc/screenshotTools.js +8 -5
- package/Misc/screenshotTools.js.map +1 -1
- package/Physics/v2/characterController.d.ts +8 -0
- package/Physics/v2/characterController.js +12 -5
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/package.json +1 -1
|
@@ -125,6 +125,14 @@ export class PhysicsCharacterController {
|
|
|
125
125
|
* default 1e38
|
|
126
126
|
*/
|
|
127
127
|
this.characterStrength = 1e38;
|
|
128
|
+
/**
|
|
129
|
+
* Acceleration factor. A value of 1 means reaching max velocity immediately
|
|
130
|
+
*/
|
|
131
|
+
this.acceleration = 0.05;
|
|
132
|
+
/**
|
|
133
|
+
* maximum acceleration in world space coordinate
|
|
134
|
+
*/
|
|
135
|
+
this.maxAcceleration = 50;
|
|
128
136
|
/**
|
|
129
137
|
* character mass
|
|
130
138
|
* default 0
|
|
@@ -1195,17 +1203,16 @@ export class PhysicsCharacterController {
|
|
|
1195
1203
|
desiredVelocitySF.scaleInPlace(len);
|
|
1196
1204
|
const diff = this._tmpVecs[5];
|
|
1197
1205
|
desiredVelocitySF.subtractToRef(relative, diff);
|
|
1198
|
-
// Clamp it by
|
|
1206
|
+
// Clamp it by maxAcceleration and limit it by gain.
|
|
1199
1207
|
{
|
|
1200
1208
|
const lenSq = diff.lengthSquared();
|
|
1201
|
-
const
|
|
1202
|
-
const maxVelocityDelta = 50.0 * deltaTime;
|
|
1209
|
+
const maxVelocityDelta = this.maxAcceleration * deltaTime;
|
|
1203
1210
|
let tmp;
|
|
1204
|
-
if (lenSq *
|
|
1211
|
+
if (lenSq * this.acceleration * this.acceleration > maxVelocityDelta * maxVelocityDelta) {
|
|
1205
1212
|
tmp = maxVelocityDelta / Math.sqrt(lenSq);
|
|
1206
1213
|
}
|
|
1207
1214
|
else {
|
|
1208
|
-
tmp =
|
|
1215
|
+
tmp = this.acceleration;
|
|
1209
1216
|
}
|
|
1210
1217
|
diff.scaleInPlace(tmp);
|
|
1211
1218
|
}
|