3D Direction Progress

2024-07-20に共有
WASDEQ - move camera WASDEQキーでカメラ移動
Arrows - rotate camera 矢印キーでカメラ回転
Sliders - rotate arrow objects スライダーで矢印回転

I finally got an object (the blue arrow) to rotate in 3D using Euler angles. Instead of just rotating around the world's X,Y and Z axies, the arrow is able to be rotated around its own Y,X and Z axises (in that order, but you have to calculate them in reverse order), which is really natural (imagine it were a plane, or a person's head).

However... I also want to make it so we can point a sprite (roughly, it will not be perfect) in any 3d direction as well. So a goal is to make the red arrow point in the direction of the blue arrow.
(In cases where the blue arrow is pointing directly in or out of the camera, we could make the red arrow change size or switch to a different costume.)
This could be used to make sprite character models like Mario!

@CodingBio and @TheGreenFlash for some 3D code
@ggenjie for help/advice with 3D rotations etc

tags:
Euler angles Euler rotations Euler rotation matrix
3D rotations XYZ rotation YXZ rotation ZXY rotation
Direction cosine matrix Bank Yaw Pitch Roll
sprite 3d sprite direction 3d 3d direction
オイラー角 オイラー回転 回転行列