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

天行健 君子當自強而不息

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 閱讀(361) 評論(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>
            制服诱惑一区二区| 久久大香伊蕉在人线观看热2| 欧美va亚洲va日韩∨a综合色| 亚洲第一在线综合网站| 久久一综合视频| 美女成人午夜| 日韩午夜视频在线观看| 亚洲美女网站| 国产精品一区二区久久精品| 久久国产天堂福利天堂| 久久久精彩视频| 99视频一区二区| 亚洲欧美精品中文字幕在线| 国内精品久久久久久影视8| 米奇777超碰欧美日韩亚洲| 欧美69视频| 午夜精品免费| 久久婷婷国产综合国色天香| 日韩一区二区福利| 亚洲欧美视频一区| 91久久精品美女| 亚洲网站在线观看| 1000部精品久久久久久久久| 亚洲人成77777在线观看网| 国产精品va在线| 久久五月婷婷丁香社区| 欧美激情区在线播放| 久久9热精品视频| 欧美高清视频一区二区| 欧美在线精品免播放器视频| 噜噜噜噜噜久久久久久91 | 蜜桃视频一区| 亚洲一区二区精品在线观看| 久久精品成人一区二区三区| 一区二区三区黄色| 久久久久久久999精品视频| 中文亚洲字幕| 蜜桃久久av一区| 欧美一区二区三区免费观看视频| 久久综合中文字幕| 久久精品国产第一区二区三区| 欧美不卡视频一区| 久久久久一本一区二区青青蜜月| 欧美日韩理论| 亚洲国产欧美日韩| 精品成人国产在线观看男人呻吟| 一本久久知道综合久久| 亚洲人午夜精品免费| 欧美在线看片| 久久精品国产一区二区三区| 欧美视频二区| 99这里有精品| 99国产精品99久久久久久| 久久久综合网| 久久精品视频在线免费观看| 国产精品毛片va一区二区三区 | 西西人体一区二区| 欧美人与性动交a欧美精品| 女人色偷偷aa久久天堂| 国产亚洲视频在线| 校园激情久久| 久久久久久九九九九| 国产亚洲电影| 香蕉久久一区二区不卡无毒影院 | 老司机免费视频一区二区三区| 国产精品久久国产精品99gif| 亚洲三级电影全部在线观看高清| 亚洲区免费影片| 欧美国产日韩一区二区在线观看| 欧美激情在线| 亚洲毛片在线观看| 欧美日韩国产在线播放| 亚洲精品一区在线| 99国产精品久久久久久久久久| 欧美国产一区在线| 亚洲精品在线观| 亚洲一区精品视频| 国产精品一区2区| 性欧美长视频| 欧美高清视频一二三区| 最近看过的日韩成人| 欧美激情视频在线免费观看 欧美视频免费一 | 老司机午夜精品视频在线观看| 久久亚洲图片| 亚洲人成在线观看| 欧美视频精品在线观看| 亚洲午夜精品一区二区| 午夜欧美精品| 在线精品高清中文字幕| 欧美国产欧美亚洲国产日韩mv天天看完整 | 黄色成人免费观看| 裸体歌舞表演一区二区| 日韩视频在线免费观看| 欧美影院视频| 亚洲人成网站在线播| 欧美日韩二区三区| 午夜亚洲影视| 亚洲风情亚aⅴ在线发布| 一区二区三区久久久| 国产日韩在线播放| 欧美成人综合一区| 亚洲欧美另类在线| 亚洲国产视频直播| 欧美中文字幕视频| 日韩午夜在线播放| 国产一区二区观看| 欧美日韩精品高清| 久久免费高清| 亚洲丝袜av一区| 亚洲成色最大综合在线| 欧美一二三区精品| 日韩视频免费看| 国产一区日韩二区欧美三区| 欧美国产欧美亚洲国产日韩mv天天看完整 | 亚洲欧美日韩电影| 亚洲人成人一区二区三区| 久久九九电影| 亚洲网址在线| 亚洲美洲欧洲综合国产一区| 国产三区精品| 国产精品高潮呻吟久久| 欧美激情第五页| 久久综合久久88| 久久精品30| 午夜视频精品| 亚洲一区二区三区在线| 亚洲经典三级| 亚洲国产电影| 欧美成人自拍视频| 久热这里只精品99re8久| 性欧美xxxx视频在线观看| 99精品欧美一区二区三区| 在线播放中文一区| 精品av久久707| 激情小说亚洲一区| 国产一区二区三区在线观看精品| 国产精品久久久久国产a级| 欧美日韩123| 欧美日韩久久| 欧美日韩美女在线观看| 欧美—级在线免费片| 欧美高清视频| 欧美激情综合网| 欧美精品一区二区精品网| 欧美好吊妞视频| 欧美大胆a视频| 欧美激情一区二区三区在线| 欧美本精品男人aⅴ天堂| 免费观看欧美在线视频的网站| 久久久久久久久综合| 久久人人97超碰国产公开结果| 久久久高清一区二区三区| 久久国产手机看片| 久久亚洲色图| 欧美成人综合| 欧美性色视频在线| 国产乱肥老妇国产一区二 | 久久精品人人做人人综合| 欧美在线一级视频| 久久综合九色综合久99| 欧美电影免费观看高清| 欧美经典一区二区三区| 欧美日韩精品免费观看视频完整 | 亚洲欧美日韩综合一区| 午夜在线一区二区| 理论片一区二区在线| 欧美激情按摩在线| 国产精品乱码人人做人人爱| 国产欧美午夜| 亚洲国产精品久久久久秋霞影院| 亚洲免费激情| 欧美一级在线视频| 欧美成年人视频| 日韩写真视频在线观看| 亚洲欧美国产77777| 久久久久欧美精品| 欧美日韩不卡在线| 国产原创一区二区| 一本一本久久a久久精品综合妖精 一本一本久久a久久精品综合麻豆 | 国产精品视频yy9099| 韩国v欧美v日本v亚洲v| 亚洲精品在线免费| 久久电影一区| 亚洲欧洲中文日韩久久av乱码| 亚洲一区二区网站| 欧美成人精品不卡视频在线观看| 欧美午夜剧场| 亚洲国产导航| 久久精品亚洲一区二区三区浴池| 欧美激情一区二区三区在线视频观看 | 亚洲人成在线观看一区二区| 午夜欧美精品久久久久久久| 欧美88av| 好吊色欧美一区二区三区四区| 日韩视频专区| 免费在线观看精品| 亚洲欧美日韩国产综合在线 | 久热这里只精品99re8久| 国产精品久久久久婷婷| 亚洲人成网站777色婷婷|