mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 23:53:09 +02:00
use var for maxvelocity
This commit is contained in:
parent
0e16686fb8
commit
53173d8f03
1 changed files with 8 additions and 7 deletions
|
@ -13,18 +13,19 @@ function filter(p) {
|
||||||
/* Reject if modifications made to Model properties */
|
/* Reject if modifications made to Model properties */
|
||||||
if (p.modelURL || p.compoundShapeURL || p.shape || p.shapeType || p.url || p.fps || p.currentFrame || p.running || p.loop || p.firstFrame || p.lastFrame || p.hold || p.textures || p.xTextureURL || p.yTextureURL || p.zTextureURL) { return false; }
|
if (p.modelURL || p.compoundShapeURL || p.shape || p.shapeType || p.url || p.fps || p.currentFrame || p.running || p.loop || p.firstFrame || p.lastFrame || p.hold || p.textures || p.xTextureURL || p.yTextureURL || p.zTextureURL) { return false; }
|
||||||
|
|
||||||
/* Clamp velocity to 5 units/second. Zeroing each component of acceleration keeps us from slamming.*/
|
/* Clamp velocity to maxVelocity units/second. Zeroing each component of acceleration keeps us from slamming.*/
|
||||||
|
var maxVelocity = 5;
|
||||||
if (p.velocity) {
|
if (p.velocity) {
|
||||||
if (p.velocity.x > 5) {
|
if (p.velocity.x > maxVelocity) {
|
||||||
p.velocity.x = 5;
|
p.velocity.x = maxVelocity;
|
||||||
p.acceleration.x = 0;
|
p.acceleration.x = 0;
|
||||||
}
|
}
|
||||||
if (p.velocity.y > 5) {
|
if (p.velocity.y > maxVelocity) {
|
||||||
p.velocity.y = 5;
|
p.velocity.y = maxVelocity;
|
||||||
p.acceleration.y = 0;
|
p.acceleration.y = 0;
|
||||||
}
|
}
|
||||||
if (p.velocity.z > 5) {
|
if (p.velocity.z > maxVelocity) {
|
||||||
p.velocity.z = 5;
|
p.velocity.z = maxVelocity;
|
||||||
p.acceleration.z = 0;
|
p.acceleration.z = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue