Sorry if this is the wrong place for this. In my most recent game, I needed a way to limit a kinematic object's rotation to stay within certain bounds while using the touch rotate control node. There may be a way to do this natively in Buildbox but I couldn't find it. So I modified the Position Limiter node so that it would lock the object's XYZ rotation instead of position and figured other people might find this useful too. To do this, drag a Position Limiter node into the object's node map, then edit the code and replace it with the code at the end of my post. Then you can enter the minimum and maximum values just like you would in a regular position limiter node and the object won't rotate outside of those bounds. var _max; var _min; var _enabled = false; function init(){ _max = this.attribute('Max'); _min = this.attribute('Min'); } function start(){ } function update(dt){ if(!_enabled){ return; } let rot = this.entity().rotation(); if(rot.x > _max.x){ rot.x = _max.x; } if(rot.y > _max.y){ rot.y = _max.y; } if(rot.z > _max.z){ rot.z = _max.z; } if(rot.x < _min.x){ rot.x = _min.x; } if(rot.y < _min.y){ rot.y = _min.y; } if(rot.z < _min.z){ rot.z = _min.z; } this.entity().setRotation(rot.x, rot.y, rot.z); } function signal(name, value){ _enabled = value; }

I just found this thread. It is exactly what I need but if I delete whats inside Position Limiter and replace with this code the object goes crazy and moves all over the place. Does it work with latest Buildbox?

This should work if you properly set it to work for - / + degrees Code: var _max; var _min; var _enabled = false; function init() { _max = this.attribute('Max'); _min = this.attribute('Min'); } function update(dt) { if (!_enabled) { return; } let rot = this.entity().rotation(); if (_max.x != null && rot.x > _max.x) { rot.x = _max.x; } if (_max.y != null && rot.y > _max.y) { rot.y = _max.y; } if (_max.z != null && rot.z > _max.z) { rot.z = _max.z; } if (_min.x != null && rot.x < _min.x) { rot.x = _min.x; } if (_min.y != null && rot.y < _min.y) { rot.y = _min.y; } if (_min.z != null && rot.z < _min.z) { rot.z = _min.z; } this.entity().setRotation(rot.x, rot.y, rot.z); } function signal(name, value) { _enabled = value; }

In some rare cases when you would like to limit only the positive values of degrees you can use this: Code: var _max; var _min; var _enabled = false; function init() { _max = this.attribute('Max'); _min = this.attribute('Min'); } function start() { } function update(dt) { if (!_enabled) { return; } let rot = getPositiveDegreesFromRotation(this.entity().rotation()); if (_max.x != null && rot.x > _max.x) { rot.x = _max.x; } if (_max.y != null && rot.y > _max.y) { rot.y = _max.y; } if (_max.z != null && rot.z > _max.z) { rot.z = _max.z; } if (_min.x != null && rot.x < _min.x) { rot.x = _min.x; } if (_min.y != null && rot.y < _min.y) { rot.y = _min.y; } if (_min.z != null && rot.z < _min.z) { rot.z = _min.z; } this.entity().setRotation(rot.x, rot.y, rot.z); } function signal(name, value) { _enabled = value; } function getPositiveDegreesFromRotation(rotation) { const x = (rotation.x + 360) % 360; const y = (rotation.y + 360) % 360; const z = (rotation.z + 360) % 360; return new THREE.Vector3(x, y, z); }