[SOLVED] Rotation with Selector.js

hello guys … How can I give rotation to an entity when Raycast plays it and stop when Raycast comes out? in plycanvas there is something similar but there is change of material instead of rotation…https://playcanvas.com/project/578421/overview/vrr

(the vr starter kit… )
Maybe I would like him to do something like this

//var Siempre = pc.createScript(‘siempre’);

Siempre.prototype.update = function(dt) {
this.entity.rotate(0 * dt, 6.11* dt, 0 * dt);
Thanks in advance for answering… :slight_smile:

Someone knows? I work in editor but i cant modify scripts. Mmm sorry this is something hard for me

There’s a couple of ways to do this. In this case, it looks like the easiest way to do this to edit box.js

There are function callbacks for when the camera has just hovered (onHover) and when it moves off the box (onUnhover). You can set/unset a flag (eg. rotateMe) in these callbacks and then check on the update function whether or not to rotate the entity.

I tried to do something. (Sorry, I have never edited a script). The screen does not show error now, I think I’m not so bad, but still no movement :confused: this is what i did https://playcanvas.com/editor/code/578421?tabs=14600229

I had to make some changes to the project as you got rid of box.js but didn’t update the script references on the entities themselves: https://playcanvas.com/editor/scene/648453

How much programming experience do you have? It be worth going through one of the tutorials to get your head round how PlayCanvas works: https://developer.playcanvas.com/en/tutorials/keepyup-part-one/

You have saved my life. :slight_smile: i will review you suggest tutorial project to learning

Hi… i tried use the original sript box.js for change box material with selector… works perfect but no if camera is child of marker in ARproject. Is the same, without changes,. But not work. Im confused can you help me? https://playcanvas.com/editor/project/580862 I used follow.js to stabilize the movement of the camera. the important thing is to do a change of material when the ARmarker is activated (appears)

perhaps the measurement of space is different from an ARcamera?