From 3a17a64c991108a04d1dfc1d817d3db028cbabc1 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 24 Jan 2017 11:56:50 -0800 Subject: [PATCH] V1 of these filters --- .../entity-server-filter-example.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/script-archive/entity-server-filter-example.js b/script-archive/entity-server-filter-example.js index 2ccb550acd..ce35964a79 100644 --- a/script-archive/entity-server-filter-example.js +++ b/script-archive/entity-server-filter-example.js @@ -9,6 +9,25 @@ function filter(p) { /* Can also reject altogether */ if (p.userData) { return false; } + + /* 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; } + + /* Clamp velocity to 10 units/second. Zeroing each component of acceleration keeps us from slamming.*/ + if (p.velocity) { + if (p.velocity.x > 10) { + p.velocity.x = 10; + p.acceleration.x = 0; + } + if (p.velocity.y > 10) { + p.velocity.y = 10; + p.acceleration.y = 0; + } + if (p.velocity.z > 10) { + p.velocity.z = 10; + p.acceleration.z = 0; + } + } /* If we make it this far, return the (possibly modified) properties. */ return p;