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

天行健 君子當自強而不息

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 閱讀(360) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            国产一区 二区 三区一级| 国产精品一区二区黑丝| 久久久99精品免费观看不卡| 欧美自拍偷拍| 麻豆精品精品国产自在97香蕉| 久久久久国产精品人| 欧美国产视频在线| 国产精品乱码一区二区三区| 亚洲国产高潮在线观看| 亚洲欧美日韩中文播放| 亚洲精品一区中文| 国产亚洲一区在线播放| 欧美中文在线视频| 欧美激情精品| 亚洲欧美激情四射在线日| 久久久免费av| 亚洲精品乱码久久久久久蜜桃91 | 欧美一站二站| 在线激情影院一区| 亚洲性夜色噜噜噜7777| 久久五月天婷婷| 99国产精品一区| 亚洲永久在线观看| 一本大道av伊人久久综合| 久久精品国产亚洲一区二区| 在线观看视频一区二区| 欧美一区二区免费观在线| 亚洲欧洲视频| 久久国产精品99精品国产| 欧美日韩在线视频一区| 国自产拍偷拍福利精品免费一| 一本一本久久a久久精品综合妖精| 久久一区激情| 欧美日韩成人免费| 亚洲日本成人女熟在线观看| 欧美永久精品| 欧美激情精品久久久久久变态| 午夜一区二区三区不卡视频| 日韩一区二区高清| 欧美精品一区二区高清在线观看| 尤物九九久久国产精品的特点| 亚洲乱码精品一二三四区日韩在线| 久久美女性网| 在线播放亚洲| 国产精品99久久久久久www| 欧美日本一道本在线视频| 亚洲美女在线国产| 久久国产精品网站| 午夜久久影院| 欧美一级电影久久| 国内精品美女av在线播放| 在线欧美福利| 亚洲欧美日韩在线一区| 亚洲一区二区黄| 欧美黑人多人双交| 欧美+日本+国产+在线a∨观看| 久久精品在线| 久久都是精品| 国产精品网站一区| 久久久人人人| 久久久999精品视频| 欧美一区二区高清| 国产精品美女久久久久aⅴ国产馆| 亚洲国产精品精华液2区45| 欧美日韩另类一区| 欧美一区二区三区在线播放| 欧美日韩午夜在线| 亚洲美女尤物影院| 亚洲婷婷综合色高清在线 | 午夜精品区一区二区三| 欧美日本韩国一区| 亚洲福利av| 日韩视频中文字幕| 亚洲欧美日韩综合| 久久av一区二区三区亚洲| 国产精自产拍久久久久久| 亚洲视频一区二区免费在线观看| 一区二区三区国产在线| 亚洲欧美日韩精品在线| 午夜日韩激情| 国产在线播放一区二区三区| 久久久国产成人精品| 欧美成人视屏| 国产精品日韩精品| 亚洲欧美日韩在线| 另类激情亚洲| 国产精品久久777777毛茸茸| 米奇777在线欧美播放| 欧美色欧美亚洲另类二区| 中文一区二区在线观看| 欧美一区二区三区免费观看视频| 国产一区二区久久精品| 麻豆91精品| 亚洲作爱视频| 久久久www成人免费精品| 欧美日本免费| 亚洲欧美变态国产另类| 免费视频亚洲| 亚洲视频免费在线| 国产视频精品va久久久久久| 一区二区三区国产盗摄| 亚洲精品一区二| 国产精品久久久久久影视 | 99热在这里有精品免费| 性欧美精品高清| 亚洲国产毛片完整版 | 亚洲女同性videos| 欧美刺激性大交免费视频| 亚洲特色特黄| 在线电影一区| 国产精品欧美日韩| 欧美jizzhd精品欧美巨大免费| 久久久久国产精品麻豆ai换脸| 亚洲国产一区二区三区在线播| 欧美视频在线播放| 久久夜色精品国产| 亚洲午夜激情| 午夜一级在线看亚洲| 亚洲国产综合在线| 国产日韩欧美精品| 欧美日韩一二区| 老司机精品视频一区二区三区| 美女国内精品自产拍在线播放| 亚洲午夜电影网| 亚洲精品久久久久久久久| 国产真实乱偷精品视频免| 国产精品国产三级国产普通话蜜臀 | 久久国产精品99精品国产| 一区二区三区日韩欧美精品| 欧美激情视频在线播放| 久久精品国产99| 国产一区观看| 国产精品乱人伦中文| 欧美日韩国产一区二区三区地区| 久久嫩草精品久久久精品一| 校园春色国产精品| 麻豆精品91| 久久久蜜桃精品| 久久精品官网| 性伦欧美刺激片在线观看| 亚洲夜晚福利在线观看| 一区二区三区成人| 99国产精品视频免费观看| 亚洲人成精品久久久久| 18成人免费观看视频| 一区二区在线观看视频| 欧美韩日亚洲| 欧美激情麻豆| 欧美剧在线免费观看网站| 欧美国产精品中文字幕| 免费在线观看日韩欧美| 嫩模写真一区二区三区三州| 欧美成人一区二区三区| 亚洲校园激情| 午夜电影亚洲| 久久成人免费电影| 久久黄色小说| 麻豆视频一区二区| 欧美日韩国产丝袜另类| 欧美日韩黄色一区二区| 国产精品成人一区二区| 国产精品视频| 国语精品一区| 亚洲乱码国产乱码精品精98午夜| 日韩视频在线免费| 亚洲一区激情| 亚洲精品一区二区三区99| 99国内精品| 欧美一区二区性| 你懂的网址国产 欧美| 亚洲激情网站| 亚洲免费在线电影| 久久一区中文字幕| 欧美日韩免费高清一区色橹橹| 国产精品嫩草影院一区二区| 国产视频在线观看一区| 亚洲福利视频一区二区| 国产视频观看一区| 亚洲国产你懂的| 亚洲一区国产精品| 久久综合影音| 一区二区三区精品视频在线观看| 亚洲欧美一区二区原创| 蜜臀99久久精品久久久久久软件| 欧美日韩免费在线| 黄色亚洲在线| 亚洲亚洲精品三区日韩精品在线视频| 欧美一区二区高清在线观看| 欧美18av| 亚洲欧美一区在线| 欧美国产亚洲精品久久久8v| 国产欧美精品日韩| 国产欧美精品va在线观看| 亚洲激情社区| 久久精品噜噜噜成人av农村| 亚洲精品国产精品国自产观看浪潮| 欧美国产视频一区二区| 亚洲天堂av在线免费| 欧美成人免费观看| 好看的日韩av电影|