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

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

1 CSE 471 Media Processing and Multimedia Other Animation Ideas… Vectors and such Asteroids A Car Game Collisions with textures Examples are in C#

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

View Full Document
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?
3 CSE 471 Media Processing and Multimedia Vectors p X Y r v a

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

View Full Document
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
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?

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

View Full Document
6 CSE 471 Media Processing and Multimedia Simple… d = (cos(r), sin(r) )
7 CSE 471 Media Processing and Multimedia An Asteroids game

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

View Full Document
8 CSE 471 Media Processing and Multimedia What do we need for ship motion? ???
9 CSE 471 Media Processing and Multimedia Ship motion Position (vector) Velocity (vector) Angle (scalar) Acceleration (scalar) Why not a vector?

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

View Full Document
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?
11 CSE 471 Media Processing and Multimedia I wanted to create a “car” game First, the car…

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

View Full Document
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
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)); }

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

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online