I wrote my own here, it’s a lot mathematical, but there is a good part of usages at the end.
IMO, math for dummies wiki should’ve had something on dot and cross products.
I agree. There are a dozen uses for dot product that are not obvious from any of the “what specifically it is” descriptions.
It’s straight forward to explain why v1 dot v2 is |v1| * |v2| * cos(v1 v v2)
…but that doesn’t tell you why the value is useful.
As one who skipped the ‘learn the basics’ step, i totaly support the learning progress. While i use dot/cross where i know it does its job, i am not able to see where it might be used too since i am missing the underlying math understanding.
So in summary, what I achieved via trigonometry is for a geometry to “look” at the player NOT at (0,0,0) the origin by rotating about the Y axis when the geometry position is NOT (0,0,0) at the origin.
If @pspeed could post how to solve this via Vector dot product and cross product. And a second solution via Vectors and Quaternions that would be appreciated.
I’ll eventually find the solution, but for those who are just trying to get on with game development it will be useful.
Light dimming and re-positioning.
Added some randomness to the light radius.
The key for me was to think in “axes space” or whatever. If you think of a local orientation as it’s three axis vectors then uses for the dot product may pop in. Like, distance “in front” is a dot with the z-axis and so on.
With an intuitive grasp of what the dot product is giving you (doesn’t matter how it gets it) then things like plane intersection become derivable instead of having to look it up. Closest point on a line segment can similarly be rederived once dot product utility is second nature.
Cross product is usual for finding axis vectors… but it also has an interesting side effect that it’s length is the sine between the two vectors. It comes up rarely but when you have two vectors you can find the local tangent (slope) of the angle between them with the length of the cross product over the dot product.
(For those who don’t know: cross product between to vectors will give you a third vector that is 90 degrees from both of those.)
The short hand is thus:
object1 at v1 wants to look at object2 at v2
lookVector = v2.subtract(v1).normalize();
leftVector = lookVector.cross(upVector); // usually up vector is UNIT_Y unless you are looking down UNIT_Y
upVector = leftVector.cross(lookVector);
// Note: from memory I frequently get the cross products backwards so I might have those flipped... should be obvious from the resulting vectors
In JME/OpenGL space, leftVector, upVector, lookVector are the columns of a 3x3 rotation matrix.
[leftVector.x][upVector.x][lookVector.x]
[leftVector.y][upVector.y][lookVector.y]
[leftVector.z][upVector.z][lookVector.z]
…and that’s all that Quaternion lookAt() is doing, basically. It’s just skipping the creation of the matrix and going directly past the matrix->quaternion math.
No matter what: whatever you want to “look at” you will need to have the idea of what your axes of rotation look like… but knowing what to “look at”, you already have one vector (in JME this is the z-axis but some engines will use the x-axis). You just don’t know which way to roll yet unless you calculate either the left vector or the up vector… and then the third can be easily determined with the cross product. In games, most of the time when we look at something we want to keep the player’s head “up” towards the sky… this is why look.cross(UNIT_Y) gives us a reasonable starting point for the x-axis vector.
Ive been working on designs for capital ships for Starlight
A carrier:
A battleship:
The ships are all build from voxels and are fully destructable. Here is a ship mid battle having taken a small amount of damage
And here the same ship has been totally destroyed, with a debris field
I think i need to do some work on the debris, currently it is just unpainted hull texture. I also plan on adding some bump mapping to make the hulls look a bit less flat
Keeping my eye on this one.
Is there an eventual target style you have in mind?
Plan is for it to be VR based (you standing in a holographic war room controlling your fleet with control panels surrounding you). Storyline driven missions. No resource gathering but instead managing the ships (and energy, ammunition and fighters) you start with to try to defeat computer controlled fleets
This is a robot sphere sleeping and I’m showcasing the GLOW MAP.
Actually this is the most complex material I’ve created because it contains the following maps:
Diffuse
Glow
Normal
Specular
Edit:
Just received the Hard Drive that I ordered. Ubuntu Linux here I come!
Those ships remind me of the lightspeed frontier ships.
And that battleship just looks awesome!
Looking good!
If you ever get stuck on anything and need second opinion, feel free to send me a DM. I was seldom involved with larger systems, as I mostly did bugfixing, but as MoffKalast completely drifted out of gamedev, I believe I’m the last one of the Lightspeed Frontier devs still (somewhat) active here.
Hello Everyone.
This is my first post from my Ubuntu hard drive.
Yay Linux!
Great decision!
Welcome my friend…
Enjoy the freedom and speed.
I slapped together this little scene trying to test my image compression process when exporting a game. This first image is without image compression with an asset.jar file of 68.4Mb and the second image is with image compression and the assets.jar file is 18.1Mb.
Uncompressed images:
Compressed images:
Assets complements of:
This work is based on “Abandoned Couch” (Abandoned Couch - Download Free 3D model by max_forsberg [ed39cf8] - Sketchfab) by max_forsberg (max_forsberg - Sketchfab) licensed under CC-BY-4.0 (Deed - Attribution 4.0 International - Creative Commons)
This work is based on “Door Wooden _ 11MB” (Door Wooden _ 11MB - Download Free 3D model by Mehdi Shahsavan (@ahmagh2e) [9042580] - Sketchfab) by Mehdi Shahsavan (Mehdi Shahsavan (@ahmagh2e) - Sketchfab) licensed under CC-BY-4.0 (Deed - Attribution 4.0 International - Creative Commons)
This work is based on “Joker (Emperor)” (Joker (Emperor) - Download Free 3D model by 3D MODELS (@3dworldz) [45a8055] - Sketchfab) by CAPTAAINR (https://sketchfab.com/CAPTAAINR) licensed under CC-BY-4.0 (Deed - Attribution 4.0 International - Creative Commons)
This work is based on “Shield_8MB” (Shield_8MB - Download Free 3D model by Mehdi Shahsavan (@ahmagh2e) [70a8c5d] - Sketchfab) by Mehdi Shahsavan (Mehdi Shahsavan (@ahmagh2e) - Sketchfab) licensed under CC-BY-4.0 (Deed - Attribution 4.0 International - Creative Commons)
What happened to the joker’s arms in the second picture?
He’s been disarmed.
…I’ll show myself out.
wHAHA, I did not even see that. The animation that came with the joke had this stutter for some reason.