Impossible a Simple Rotation

i just want a functional rotating :DD

I’ve been pulling my hair out for 3+ hours, you can do it at the number of comments in the meme if, a simple .rotate doesn’t work when I have Math.Pi inside only a single digit works but I can’t absolutely not showing in the console.log because I always have X:0 Y:0 Z:0, go to line 155 and 169 for a simple order .rotate 90 on X axis. pls help me :DDD

@Joffrey_Vedlem_Ved

A couple of things

  1. Making the rotation 90 degs means with the cube the rotation is not noticeable, change to 45 degs
  2. The vertical rotation should be about the X or Z axis. You have both rotations about the Y axis.

Here is a playground showing these applied

Most people will find it easier to give answers if you use the playground rather than CodePen. However CodePen is better than no running code.

2 Likes

I can see that. I think my all favorite is the trial from line 172 (90 * Math.PI / 180). :thinking:
At least, you are creative. :smiley: Else, same as @JohnK, I think it would have been easier to quickly tour the doc. I can assure you the doc is quite straight forward and not all too boring to read (as opposed to others). And then, before banging your head, know that you can come to the forum anytime and you will most likely get the answer you need within minutes or a few hours. I often do so even for the most basic things. Basics is all I know about anyways :wink: so don’t be ashamed to ask.
Meanwhile, have a great Xmas. :christmas_tree:

Thanks for all <3 I have a last question, why console.log dont see rotation ?

Same answer as for

1 Like

“undefined”, perhaps coding become like a bot :")

Hi,
From lines 167 to 176, replace by:

buttonVertRotate.onPointerClickObservable.add(() => {
 selector.rotation.y = (selector.rotation.y + Math.PI/6);
  console.log("selector.rotation.y is" + selector.rotation.y);
});
advancedTexture.addControl(buttonVertRotate);

Hope this helps,

EDIT: Forgot to mention that of course, the above is also equal to the slicker version

selector.rotation.y += Math.PI/6;