lecture16 - CSE 471 Media Processing and Multimedia Other...

Info iconThis preview shows pages 1–16. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CSE 471 Media Processing and Multimedia Other Animation Ideas… Vectors and such Asteroids A Car Game Collisions with textures Examples are in C#
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 CSE 471 Media Processing and Multimedia Are we sure what vectors mean? What does x,y mean? What does p=(1.7, 3.9) mean? What does v=(1.2, -0.9) mean? How fast are we going? What direction are we going? How can we express direction? What does a=(0, -9.8) mean?
Background image of page 2
3 CSE 471 Media Processing and Multimedia Vectors p X Y r v a
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 CSE 471 Media Processing and Multimedia Velocity Vectors v=(1.2, -0.9) We are moving at: 1.5 sqrt( (1.2) 2 + (-0.9) 2 ) = 1.5 A good way to express direction is as a normalized vector: d = (1.2, -0.9) / 1.5 = (0.8, -0.6) The vector for speed v 1 and direction d 1 is simply: v 1 * d 1
Background image of page 4
5 CSE 471 Media Processing and Multimedia What if we know the angle? Suppose we know the angle we are moving. How do we compute a direction vector?
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 CSE 471 Media Processing and Multimedia Simple… d = (cos(r), sin(r) )
Background image of page 6
7 CSE 471 Media Processing and Multimedia An Asteroids game
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 CSE 471 Media Processing and Multimedia What do we need for ship motion? ???
Background image of page 8
9 CSE 471 Media Processing and Multimedia Ship motion Position (vector) Velocity (vector) Angle (scalar) Acceleration (scalar) Why not a vector?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 CSE 471 Media Processing and Multimedia Computing the acceleration vector for the Euler step av = (a * cos(r), a * sin(r) ) Why would we not just compute this once and set it instead of computing each time we step?
Background image of page 10
11 CSE 471 Media Processing and Multimedia I wanted to create a “car” game First, the car…
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 CSE 471 Media Processing and Multimedia Basic step 9 type stuff Car had a black white background Used Photoshop to fill it with blue Use ImageComposite to make a 32 bit RGBA image with alpha mask I made a “Car” class Started with the Step 9 GameSprite class
Background image of page 12
13 CSE 471 Media Processing and Multimedia Car vertices and texture public Car() { float carL2 = 0.07f; // Car length / 2 float carW2 = 0.04f; // Car height / 2 this.AddVertex(new Vector2(carL2, carW2)); this.AddVertex(new Vector2(carL2, -carW2)); this.AddVertex(new Vector2(-carL2, -carW2)); this.AddVertex(new Vector2(-carL2, carW2)); this.Color = Color.Transparent; this.Transparent = true; textureC.Clear(); float inY = 0.1f; textureC.Add(new Vector2(0, 1-inY)); textureC.Add(new Vector2(0, inY)); textureC.Add(new Vector2(1, inY)); textureC.Add(new Vector2(1, 1-inY)); }
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 CSE 471 Media Processing and Multimedia Making a car drive What variables do we need for the car state?
Background image of page 14
15 CSE 471 Media Processing and Multimedia What I used… private Vector2 p = new Vector2(0, 0);
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 45

lecture16 - CSE 471 Media Processing and Multimedia Other...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online