We’ve already covered the basics of setting up a scene, a camera, the render loop ( animation loop ) and some other basics about geometry and transformations in previous tutorials. In this lesson, let’s dig into applying textures and materials to “skin” our objects and adding lights, so we can see them. Read more…
So in the first lesson, you learned about setting up the files, getting set up with a 3D helper library and doing your first render. In fact we jumped ahead in that first lesson and did a simple rotation, which is the first of our transformations we are going to look at.
Acceleration! The change of velocity over time. So, if velocity is the change of speed over time, this is the change of that velocity over time. This could be changing direction, speeding up or slowing down. Really it is just another vector applied to another over time. Because it is continually added it increases the magnitude of the that initial vector over time.
If you have been following along with the Learning tutorials so far, you’ll recognize the basis of experiment comes from Lesson 5 – Making multiple objects move In this demo, I am using radial gradient fills, a range of colors, and some good ole fashion trigonometry to create a nice 3D effect.
Check it out here: 3D Spheres on Canvas Demo
Ok so we are making a game. Well not really a game, but if we were, we might need a player object. So we have a player object a really awesome cool triangle. Lame, I know, but actually I loved asteroids and well the little dude was just a triangle. So we have a trianlge and we are going to make it rotate and move around using our learnings from previous lessons. So if you are totally lost jump back and read on Vectors and if you are really, really lost jump back and read from the start about animations.
Vectors. Yep Vectors. So what is a vector? A vector is a magnitude ( a number ) and a direction. These 2 elements are a vector. So speed is not a vector, because it is just a magnitude, but velocity is a vector because it tells how fast and in what direction something is going.
Ok, so let’s say we have a video game and your character runs around. The bad guys tend to follow you and look towards where you are. Let’s make a simple demo to illustrate this. We are going to make a triangle bad guy that flies around. He points where the mouse is on the screen.
If you recall the TAN is the opp/adj of an angle. The inverse TAN is the inverse of this value. So if we have a point at the origin and another at a distance ( x, y) from that origin. We can break the x,y into component lengths of x being the adj and the y being the opp.
Moving multiple objects is a bit misleading, if you have been reading along to this point. As you might recall from lesson 1, we are actually drawing a new image on the screen each frame , and not actually “moving” anything. However we create this illusion of motion by moving or changing things 1 frame at a time. Once we code our animation the result is motion.