3D rotation
Root / Programming Questions / [.]
randoCreated:
Ok so I found this website:
https://petercollingridge.appspot.com/3D-tutorial/rotating-objects
And so I translated he code to SB code and got a bendy cube rather than a rotating cube. It kinda just turned into a rhombus prism.
EDIT:
ID10T It's -+, not -- lol
Now it rotates properly
Ok, now I'm trying to make it so that you don't move but everything else moves. This is so that the origin is always on screen and changing. But I need to figure out how to move everything based on stick inputs and which way the player is faced. Just a side note, right now it's in first person if that matters at all.
For 3D rotations, I would recommend you to look up either Euler angles (do this one if you don't mind gimbal lock) or quartenions (do this one if you're prepared for 4-dimensional numbers and the math related with them).
There's a good video by 3Blue1Brown which explains very nicely quartenions if you want to implement them.
Man quaternions are confusing. I like euler angles exept for the gimbal lock stuff but ok I guess.
EDIT: Ok never mind. Because of the way I have this set up, I just need to increase/decrease the z value of every coordinate. (everything except player moves)
EDIT2: Well I guess the new problem now is implementing physics. That's because of how it's set up :D
A: for directional movement, you move X * sin(angle) * speed and Z * cos(angle) * speed
For rotation, I recommend the video you used it for that engine and videos in this series(this is video #2): https://youtu.be/XgMWc6LumG4
Also, don't worry about projection matrix. That's just a 2d array of the perspective formulas. If you pay attention you'll understand it.