game rules - object triggers set up

This commit is contained in:
2025-11-13 09:17:18 +02:00
parent 2a1423877b
commit c8e501ff6e
9 changed files with 98 additions and 20 deletions
+2 -2
View File
@@ -57,8 +57,8 @@ function autoScale(object, mk = 1) {
function centerOrigin(object){
let result = new Group();
let bb = getBoundingBox(object);
let position = getBoundingBoxCenterPoint(bb, object.position).negate();
result.userData.bbox = getBoundingBox(object);
let position = getBoundingBoxCenterPoint(result.userData.bbox, object.position).negate();
object.position.copy(position)
result.add(object);
return result;
+4 -1
View File
@@ -18,7 +18,10 @@ class MotionEngine {
if (mode == 'offset') {
target[key] = (initial[key] || 0) + value * k;
} else if (typeof (value) == 'function') {
target[key] = value(k);
let v = value(k, target[key]);
if (target[key] !== v){
target[key] = v;
}
} else {
target[key] = (initial[key] || 0) + (value - (initial[key] || 0)) * k;
}