Making entity rotate on x axis onclick


#1
    if (this.app.keyboard.isPressed(pc.MOUSEBUTTON_LEFT)) {
        this.sword.rotate(X =  90, Z = 0);
    }

Ok so this is my method of making the sword rotate 90 degrees after mousebutton click but doesnt work anyone know why?


#2

I think you want something like:


this.sword.rotate(90,0,0);

https://developer.playcanvas.com/en/api/pc.Entity.html#rotate
Also, you may want to set local rotation and not global.


#3

Oh ok i will check it out thank you!