[SOLVED] How to change angle of rotation?

:slight_smile: :slight_smile: I do not know how to do something so simple … I do not know what values ​​I should change to make “playcanvas cube” turn on x axis and not on axis y (how to modify it from script) https: // playcanvas.com/project/460449/overview/webvr-ray-input

in the script button-rotate.js you have this code:

// update code called every frame
ButtonRotate.prototype.update = function(dt) {
    if (this._toggled) {
        this.targetEntity.rotate(0, this.rotateSpeed * dt, 0);
        this._secsSinceRotateStart += dt;

where the rotate function takes 3 arguments (x, y, z).
So now is rotating around the y axis.
If you want to change to x rotation just switch the x and y arguments:

this.targetEntity.rotate(this.rotateSpeed * dt, 0, 0);
1 Like

Thank you very much!

1 Like