I'm just experimenting. I figured out a way to turn any 3D object into a UI button. This would allow one to do anything they wanted with buttons. Idle clicker, quiz app, whatever. It's just a single custom node. You can see the code below and the node layout. In this example you click on the 3D object and it just increases the score. Here is the code in text form so you don't have to retype it. Code: var _enabled = false; var _hit = false; //----Standart function init(){ this.emitSignal('Touched', false); this.enableTouch(); } function update( dt ){ } function signal( name, value){ _enabled = value; } //----Touches function touchBegan( point ){ let _startPoint = point; let wp = this.scene().screenToWorld(_startPoint.x, _startPoint.y); vecWP = new Vec3(wp.x, wp.y, wp.z); let pos = this.entity().position(); vecPos = new Vec3(pos.x, pos.y, pos.z); if(vecWP.distance(vecPos) <= 1.5){ this.emitSignal('Touched', true); _hit = true; log('Hit ' + _hit); } else{ log('Hit ' + _hit); } } component.touchBegan = touchBegan; function touchEnded(){ if(_hit){ this.emitSignal('Touched', false); _hit = false; } } component.touchEnded = touchEnded; You may or may not have to increase or decrease the size of the vector comparison in the if statement depending on the size of the 3D object. This line here is what I mean, I have it set to 1.5. Code: if(vecWP.distance(vecPos) <= 1.5)
When two 3d objects are placed in the same scene then how to select an individual object in the same scene?
This is cool. But there is no way to make it stay on the screen when world moves, right? I am trying to make a joystick, and can't figure out best way.