3 j s also has some built in support for object rotation. The call is like this,
you can specify x y or z for the axis of rotation. The object will rotate around
it's center along that axis in a counter clock wise fashion. The angle is
specified in radians which computers like, as a human I like degrees. So here
I'm specifying 70 degrees then converting this number to radians by multiplying
by PI over 180. Here we can see the direction is counterclockwise if you were to
point the x axis toward you. A way to remember this direction is the right-hand
rule. Even though it looks clockwise in this figure, if you put your thumb along
the x axis and rotate around you'll see it's indeed following the right-hand
rule.
three.jsはオブジェクトを回転する
機能も実装しています
コード上に回転軸として
x、y、zのいずれかを設定します
オブジェクトはその中心点を中心に
軸の周りを左回りに回転します
角度はラジアン単位で設定しますが
度のほうが考えやすいです
そこでまず70度と設定し π/180を掛け
ラジアン単位に変換します
もしx軸が手前方向を指していれば
回転の方向は左回りです
この方向は右手の法則で覚えます
この図では回転は右回りです
親指をx軸の向きに合わせ
他の指を回してみてください
指の回転の方向が図の回転と
完全に一致することが分かります
Three.js 也內建支援物件旋轉
程式像這樣,你可以指定要沿著 X, Y, Z 哪一軸旋轉
物件中心會沿著那個軸逆時針旋轉
角度是以電腦慣用的弧度為單位
身為人類我喜歡用度
我寫 70 度然後乘 PI 除 180 轉換成弧度
如果你將 X 軸指向你會看到逆時針方向
記憶方向的方法之一是使用右手法則
雖然圖上看起來像順時針
如果你的右手拇指沿著 X 軸方向,其他四指繞過,就會發現它符合右手法則