120 likes | 231 Vues
MTA Exam 98-374. Gaming Development Fundamentals. 98-374: OBJECTIVE 4. Understand Animation. Transform objects. LESSON 4.2. overview Lesson 4.2. In this lesson, you will review the following: Forming Deforming Moving Point distance Planes Interpolation Frames per second (FPS)
E N D
MTA Exam 98-374 Gaming Development Fundamentals
98-374: OBJECTIVE 4 Understand Animation
Transform objects LESSON 4.2
overviewLesson 4.2 In this lesson, you will review the following: • Forming • Deforming • Moving • Point distance • Planes • Interpolation • Frames per second (FPS) • Translation • Scale • Rotation
Lecture Lesson 4.2 Forming and Deforming • Forming is the process of putting together texture elements to create a background or terrain using primitives. • Deforming occurs when something happens, such as an explosion, that causes the animation to break apart the texture. The image becomes distorted.
lecture Lesson 4.2 Moving, Point Distance, and Planes • Moving is the process of changing the coordinates and redrawing the image on the screen to make it appear as if it is moving over time. • Point distances used to show a light source and the distance from the light source to the object. • Planes are the viewing portion of the 3-D animation; they are defined with Vector4. • The Plane structure represents a plane using a 3-D vector normal and a distance value. • Interpolation is also used to move objects; it describes how an animation transitions between values over its duration.
lecture Lesson 4.2 Animation • Frames per second (FPS) is a value that represents the number of visual frames drawn each second. • The animation FPS must be consistent across platforms; therefore, you must have a way to control the speed of your animation. • Here is an example of generating a Vector that changes the object position using the time between frames for this device: Vector3 Position += IncrementXYZ * TimeBetweenFrames/ConstantScale;
lecture Lesson 4.2 Translation, Scale, and Rotation • Translation • Moves the image/object horizontally, vertically, up, down, and diagonally • Scale • Used to resize an image • Rotation • Rotates the image around its own axis (revolution) or rotates around an external point (orbit) • In 3-D, all three transformations can be done using matrix algebra.
Translation, Scale, and RotationCONTINUED These steps must be done in this order from left to right.
lecture Lesson 4.2 Examples • Transformations in 2-D • Scale: Use a 2-D vector (2.0f, 2.0f) in the Draw() method to double the size. • Rotation: Use a float value of radians to rotate around the point marked at the origin [use MathHelper.ToRadians(20) to convert from degrees to radians]. • Translation: Change the x and y values. • 3-D Equivalents • Scale: Multiply by a scaling matrix (Matrix matrix = Matrix.CreateScale(0.5f, 0.5f, 0.5f)). • Rotation: Provide the radians of rotation; be aware of the point of origin that will determine the type of rotation. • Translation: Move objects along the x, y, and z axes.
REVIEW Lesson 4.2 Can you answer these? • How are objects transformed? • Where is translation (scale and rotation) applied within the code? • Describe each of the following in the context of animation: • Moving • Point distances • Planes