Can somebody help me understand the World Matrix of a mesh? I have been reading over the documentation but I still cannot quite grasp it. Here is where I am at in my mind:
So there is a World Origin and a Local Origin (of a mesh). The World Origin is (0, 0, 0) and everything in the World is based upon this World Origin.
Lets say I have a 1 unit cube mesh with a Local Origin of (0, 0, 0) at its center that sits perfectly on the World Origin of (0, 0, 0) at its center. If I move this cube mesh to world position (5, 5, 5). Then the World Matrix stores this Vector of (5, 5, 5)? So that Babylon know to render the cube mesh at that specific Vector…and then based on Vector…Babylon is able to access the 6 Vertices of the cube mesh relative to the cubes Local Origin and render them accordingly? Is this at least a high level understanding of what is happening?
Also does the World Matrix account for rotation as well? Or just position…assuming my thought process is even accurate in the first place.
And finally can someone help me understand this code. I know what it does as it works in my game, but I dont truly understand why it works lol:
let origin = this.camera.position;
let wm = this.camera.getWorldMatrix();
let aimVector = Vector3.TransformCoordinates(Vector3.Forward(), wm).subtract(origin).normalize();