青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

Timing in Animation and Movement(1)

Games are packed with movement. Characters running here, bullets flying there−basically there's a slew of objects moving about your game world. The smooth motion of these objects is a very important aspect that can't be overlooked. Have you ever thought about the use of movement and animation based on time? Using time−based motion is hot, and to keep up with the rest of the world you must fully understand how it can help your game project. In fact, you need to understand not only using time−based motion, but also motion in general. Do you think only characters move about in your game? Nope, your in−game cinematic cameras need your guidance as well.

 

Using Time−Based Motion

Although it might not seem important at first, timing plays a crucial role in your game projects. I'm not talking about the time of day; rather, I'm referring to down−to−the−millisecond timing of animation. This sort of precise timing is required for smooth animation and movement of objects in your project. Although it is a basic topic, it is one that all game programmers should understand quite well.

When it comes to moving your meshes, time−based motion is the best of the bunch.

The whole basis of using time−based motion is simple−movement and animation always take the same amount of time to perform on any system, regardless of the computer's actual speed. For example, a 2−GHz system processing a 20−second animation will undoubtedly do so quickly and produce a very smooth motion, whereas the same animation running on a 500−MHz system will be choppy but will still maintain the 20−second animation length.

More than likely, the slower computer will drop specific frames of the animation to keep up with the speed of the faster computer. Therein lies the secret−slower computers can drop more frames and still maintain a somewhat reasonable representation of the actual motion.

Okay, I think you're starting to get the idea. As simple as the techniques sound, time−based animation and movement remain a slight mystery to fledgling game programmers. For that reason, I want to introduce (or re−introduce) you to the world of time−based motion. I'll start with a brief look at reading time in Windows.

 

Reading Time in Windows

The easiest method of reading time in Windows is by using the timeGetTime function. This function does not take any parameters. As the following code demonstrates, timeGetTime only returns the number of milliseconds that have passed since Windows was started.

DWORD TimeSinceStarted = timeGetTime();

What good does this do you? Typically, you call the timeGetTime function once per frame that your game processes. For each frame, you then subtract the time from the last frame processed to obtain the number of milliseconds that have elapsed since your last frame. You can use this elapsed time to compute your time−based motion.

Storing the time of the last frame update is as easy as using a static variable. At the beginning of your frame's update function, insert a static variable that stores the current time.

void FrameUpdate()
{
  static DWORD LastTime = timeGetTime();

At the end of the FrameUpdate function, you can then store the current time in LastTime.

LastTime = timeGetTime();

In this manner (storing the current time at the end of your frame's update function), you have managed to store the time at which the frame update ended. During the next call to FrameUpdate, the LastTime variable will still contain the time at which the last frame update ended. Using this time value, you can calculate the amount of time that has elapsed since you last called FrameUpdate by subtracting LastTime from the current time.

DWORD ElapsedTime = timeGetTime() − LastTime;

Now what about those instances when you want to calculate the number of elapsed milliseconds based on a specific time, such as when an animation starts, instead of counting the elapsed time or when the FrameUpdate function was first called?

Just as you used a static variable to store the last frame's update time, you can store the time at which the function was first called. Using that static variable, you can determine how many milliseconds have passed since the function was first called.

void FrameUpdate()
{
  static DWORD StartTime = timeGetTime();
  DWORD ElapsedTime = timeGetTime() − StartTime;

  // ElapsedTime is the number of milliseconds that has passed since you first called FrameUpdate.
}

In the same way the previous bit of code tracked the total amount of time that has passed since the first call to the FrameUpdate function, you can embed the starting time of an animation inside your data structures.

Combined with key frames, time−based animation is a perfect solution for creating smooth animation. Read on to take a closer look at using time−based animation.


posted on 2008-04-15 15:50 lovedday 閱讀(355) 評論(0)  編輯 收藏 引用

公告

導(dǎo)航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产一区二区在线观看免费播放 | 免费观看在线综合| 亚洲一区在线直播| 国产麻豆日韩欧美久久| 久久精品在线视频| 久久久水蜜桃| 亚洲美女视频网| 一区二区三区国产精华| 国产精品免费aⅴ片在线观看| 欧美在线观看视频在线| 久久婷婷一区| 在线午夜精品| 欧美一区二区三区四区在线观看 | 日韩视频免费在线| 亚洲视频一区二区| 国产亚洲福利一区| 亚洲国产成人精品久久久国产成人一区 | 嫩草国产精品入口| 欧美精品在线观看一区二区| 亚洲欧美国产三级| 免费看的黄色欧美网站| 午夜精彩国产免费不卡不顿大片| 欧美一区二区观看视频| 91久久久亚洲精品| 亚洲综合国产| 99精品视频免费全部在线| 亚洲欧美精品在线观看| 亚洲人成在线观看| 午夜日韩电影| 一区二区三区免费在线观看| 久久岛国电影| 亚洲综合色噜噜狠狠| 美女在线一区二区| 欧美中文在线免费| 欧美日韩午夜在线| 欧美激情1区| 国内精品伊人久久久久av一坑| 99精品国产在热久久下载| 在线视频观看日韩| 午夜免费久久久久| 亚洲在线一区| 欧美日韩美女一区二区| 欧美国产一区二区三区激情无套| 国产区日韩欧美| 亚洲性视频网址| 亚洲在线成人精品| 欧美精品一区在线| 欧美激情一级片一区二区| 国语精品中文字幕| 亚洲欧美久久久| 午夜国产精品视频| 国产精品国产三级国产aⅴ入口| 亚洲人成在线观看网站高清| 亚洲电影成人| 久久亚洲影院| 欧美成人在线网站| 亚洲国产1区| 久久久噜噜噜久噜久久| 久久一综合视频| 韩日精品视频一区| 久久精品中文| 美日韩精品视频| 亚洲电影在线免费观看| 老巨人导航500精品| 欧美成人午夜剧场免费观看| 亚洲高清在线观看一区| 久久综合狠狠综合久久综青草| 美女免费视频一区| 亚洲电影一级黄| 欧美国产精品v| 亚洲日本欧美在线| 亚洲午夜在线| 国产精品五区| 久久久久国色av免费观看性色| 浪潮色综合久久天堂| 亚洲黄色av一区| 欧美日韩成人一区二区| 一区二区成人精品| 久久久精品国产免费观看同学| 一区二区亚洲精品国产| 免费观看久久久4p| 国产精品99久久不卡二区| 欧美在线影院| 亚洲电影免费在线| 国产精品成人国产乱一区| 欧美一级视频精品观看| 欧美黄色免费| 午夜欧美精品| 亚洲国产精品ⅴa在线观看| 欧美片网站免费| 欧美一区二区三区视频在线观看| 欧美福利视频一区| 亚洲综合色激情五月| 在线观看国产精品淫| 欧美另类视频在线| 欧美一区影院| 亚洲日本欧美天堂| 久久久久久久成人| 99re6热在线精品视频播放速度| 国产精品区免费视频| 久久琪琪电影院| 亚洲一区在线播放| 亚洲成人自拍视频| 久久激情一区| aa级大片欧美| 亚洲国产成人av| 国产精品一区二区久久久久| 欧美成人免费视频| 欧美资源在线| 亚洲婷婷国产精品电影人久久| 欧美好骚综合网| 久久精品一级爱片| 亚洲综合999| 亚洲精品在线一区二区| 国内外成人免费激情在线视频网站 | 日韩视频不卡中文| 欧美77777| 久久精品亚洲乱码伦伦中文 | 午夜精品久久久久久| 亚洲乱码国产乱码精品精天堂| 国产在线精品一区二区夜色| 欧美日韩在线直播| 欧美激情一区二区三区全黄| 久久久福利视频| 亚洲欧美在线看| 中文日韩在线| 一区二区三区四区蜜桃| 亚洲黄一区二区| 亚洲高清影视| 欧美激情亚洲自拍| 欧美电影免费观看| 欧美国产日韩一区二区三区| 久久精品99国产精品日本| 欧美一级专区免费大片| 亚洲综合电影一区二区三区| 在线一区二区视频| 亚洲一卡二卡三卡四卡五卡| 在线中文字幕一区| 一区二区av| 亚洲性线免费观看视频成熟| 中文欧美字幕免费| 亚洲性xxxx| 亚欧成人在线| 久久国产精品久久国产精品| 久久不见久久见免费视频1| 欧美伊人久久大香线蕉综合69| 欧美一区二区三区婷婷月色 | 欧美成人在线影院| 亚洲福利av| 99国产精品| 亚洲一线二线三线久久久| 午夜精品视频网站| 久久国产精品电影| 麻豆精品视频在线观看| 欧美二区在线播放| 欧美日韩影院| 国产亚洲va综合人人澡精品| 国内精品视频666| 精品99一区二区| 日韩视频一区二区三区在线播放免费观看 | 亚洲品质自拍| 一区二区三区免费在线观看| 亚洲一卡久久| 久久久久久穴| 欧美麻豆久久久久久中文| 国产精品老牛| 在线日韩视频| 亚洲视频一区二区在线观看| 欧美在线黄色| 亚洲第一搞黄网站| 亚洲午夜精品久久久久久浪潮| 久久精品亚洲热| 欧美人与禽性xxxxx杂性| 国产欧美日韩不卡免费| 亚洲福利在线看| 亚洲一区bb| 老鸭窝毛片一区二区三区 | 久久精品二区三区| 亚洲国产小视频在线观看| 亚洲一区二区三区四区在线观看| 久久精品一区二区三区中文字幕 | 久久久水蜜桃| 国产精品麻豆va在线播放| 在线 亚洲欧美在线综合一区| 在线一区二区日韩| 美国三级日本三级久久99| 一区二区三区久久久| 美日韩精品免费| 国产乱码精品一区二区三区忘忧草| 亚洲韩国一区二区三区| 久久精品首页| 一区二区三区日韩欧美| 另类春色校园亚洲| 欧美一级视频| 亚洲精品一二| 久久人人97超碰国产公开结果| 亚洲婷婷综合久久一本伊一区| 欧美高清影院| 欧美极品一区| 亚洲日本欧美|