Learning 3D math/drawing/manipulation from scratch
Posted: Fri Jun 02, 2023 2:22 am
So, of course there are 3D engines out there and some of them in Love2D (Grove) but I wanted to truly learn and understand the 3D space and with a little googling and a little math I can draw a 3D cube and rotate it around three axis:
It rotates just fine but it seems to rotate on more than one axis. Hard to explain. It will rotate on the Y axis as expect whilst ALSO revolving around some imaginary point. That point seems to be the screen origin - 0,0 - the top left corner of the screen.
I want the cube to rotate on the spot and not rotate around the screen origin whilst also rotating on the requested axis.
The code is super light so it's easy to share:
Key commands for rotating:
left arrow / right arrow
up arrow / down arrow
Del / PgDn
So, please note, all of this is very new and I only just learned about matrix multiplication so don't use long words please but I'm happy to google concepts.
I suspect someone will say I need to factor object, world and camera co-ordinates. Or maybe something completely different.
It rotates just fine but it seems to rotate on more than one axis. Hard to explain. It will rotate on the Y axis as expect whilst ALSO revolving around some imaginary point. That point seems to be the screen origin - 0,0 - the top left corner of the screen.
I want the cube to rotate on the spot and not rotate around the screen origin whilst also rotating on the requested axis.
The code is super light so it's easy to share:
Key commands for rotating:
left arrow / right arrow
up arrow / down arrow
Del / PgDn
So, please note, all of this is very new and I only just learned about matrix multiplication so don't use long words please but I'm happy to google concepts.
I suspect someone will say I need to factor object, world and camera co-ordinates. Or maybe something completely different.