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

天行健 君子當自強而不息

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


只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導(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>
            一片黄亚洲嫩模| 欧美激情一二三区| 亚洲专区免费| 国产欧美一区二区精品婷婷 | 欧美日韩高清不卡| 亚洲精品欧美精品| 亚洲三级视频| 欧美午夜精品久久久久免费视| 亚洲一区二区视频在线观看| 亚洲午夜久久久久久久久电影院| 国产精品丝袜久久久久久app | 亚洲欧洲日本在线| 亚洲精品中文字幕在线| 欧美调教视频| 久久精品国产成人| 美女成人午夜| 亚洲欧美日韩另类| 久久本道综合色狠狠五月| 亚洲成在人线av| 一区二区电影免费观看| 国产伦一区二区三区色一情| 欧美成人精精品一区二区频| 欧美日本视频在线| 久久久综合网站| 欧美人交a欧美精品| 香蕉久久a毛片| 欧美成人高清视频| 欧美在线视频导航| 欧美美女福利视频| 久久久噜噜噜久噜久久| 欧美日韩国产一级片| 久久久久久精| 欧美日韩一区二区三区视频| 久久嫩草精品久久久精品| 欧美日本中文| 免费影视亚洲| 国产日本欧美一区二区三区| 亚洲高清一区二| 国产自产2019最新不卡| 99在线精品视频| 亚洲日韩中文字幕在线播放| 亚洲欧美亚洲| 正在播放日韩| 欧美福利视频| 欧美国产欧美综合 | 国产精品福利在线观看| 免费在线观看一区二区| 国产欧美一区二区三区国产幕精品| 亚洲高清av| 在线欧美小视频| 久久国产色av| 午夜精品福利在线观看| 欧美精品在欧美一区二区少妇| 免费观看国产成人| 黄色成人片子| 久久精品1区| 久久久777| 国产午夜精品美女毛片视频| 亚洲一卡久久| 亚洲一区尤物| 国产精品日韩电影| 亚洲性视频网站| 亚洲摸下面视频| 国产精品久久久久久久久果冻传媒| 91久久精品国产91久久性色tv| 亚洲国产乱码最新视频| 另类人畜视频在线| 亚洲大片一区二区三区| 亚洲国产日韩一级| 欧美精品18| 一本色道**综合亚洲精品蜜桃冫 | 影音国产精品| 另类综合日韩欧美亚洲| 欧美第一黄网免费网站| 亚洲国产成人porn| 免费在线播放第一区高清av| 欧美激情aaaa| 99精品国产一区二区青青牛奶| 欧美精品激情在线| 日韩午夜一区| 欧美一区日本一区韩国一区| 国产视频精品xxxx| 久久天堂成人| 亚洲精品久久久久久一区二区 | 99伊人成综合| 国产精品海角社区在线观看| 午夜久久黄色| 欧美不卡视频一区发布| 日韩视频一区二区三区在线播放| 欧美日本一道本在线视频| 亚洲午夜精品视频| 久热re这里精品视频在线6| 亚洲人午夜精品| 国产精品视频yy9099| 久久久久青草大香线综合精品| 亚洲国产另类久久精品| 午夜久久影院| 亚洲三级色网| 国产一区二区激情| 欧美国产综合视频| 小嫩嫩精品导航| 亚洲经典视频在线观看| 欧美伊人久久久久久午夜久久久久| 一区在线播放视频| 欧美午夜精品一区| 可以看av的网站久久看| 亚洲一区二区免费| 亚洲第一精品在线| 久久精品一二三区| 亚洲午夜av电影| 亚洲高清一二三区| 国产精品网站视频| 欧美精品一区二区三区视频| 欧美专区中文字幕| 宅男66日本亚洲欧美视频| 欧美国产日韩一区二区| 久久国内精品自在自线400部| 日韩视频久久| 亚洲电影免费观看高清完整版| 国产精品久久久久久久久| 免费h精品视频在线播放| 欧美亚洲一区三区| 亚洲午夜影视影院在线观看| 亚洲日本成人在线观看| 美玉足脚交一区二区三区图片| 亚洲欧美美女| 亚洲天堂成人在线观看| 亚洲剧情一区二区| 亚洲激情国产精品| 在线成人欧美| 精品不卡一区| 国产自产精品| 国产在线观看一区| 国产日韩专区在线| 国产精品夜夜夜| 国产精品第十页| 欧美视频在线一区二区三区| 欧美激情综合在线| 欧美高清视频一区| 欧美高潮视频| 欧美福利一区二区三区| 欧美va亚洲va香蕉在线| 蜜桃久久av一区| 你懂的国产精品永久在线| 久久中文字幕一区| 美女免费视频一区| 欧美成人a视频| 欧美精品情趣视频| 欧美日韩性视频在线| 欧美日韩视频在线观看一区二区三区 | 中日韩男男gay无套| 国产精品99久久久久久久女警 | 91久久综合| 亚洲精品在线一区二区| 妖精成人www高清在线观看| 一二三区精品| 午夜久久久久久| 久久久国产精品一区二区三区| 狼狼综合久久久久综合网| 欧美**字幕| 亚洲乱码国产乱码精品精可以看 | 欧美国产精品专区| 最近看过的日韩成人| av成人免费| 欧美淫片网站| 欧美88av| 国产精品看片资源| 一区二区三区在线不卡| 亚洲精品一区二区三区婷婷月| 亚洲图片欧洲图片日韩av| 欧美一区二区三区在线观看| 久久嫩草精品久久久精品一| 欧美激情中文不卡| 亚洲图片欧美一区| 久久久国产亚洲精品| 欧美日韩精品欧美日韩精品一 | 欧美sm极限捆绑bd| 国产精品入口| 亚洲国产天堂久久综合网| 亚洲一区二区三区三| 久久婷婷国产综合国色天香| 亚洲人成在线观看| 久久国产欧美精品| 欧美日韩精品免费看| 好吊日精品视频| 中文在线一区| 亚洲成在人线av| 欧美亚洲免费高清在线观看| 欧美激情视频网站| 好吊色欧美一区二区三区视频| 一区二区国产日产| 免费久久精品视频| 亚洲性夜色噜噜噜7777| 欧美成人在线影院| 黄色精品一区| 久久久精品动漫| 亚洲午夜一区| 欧美精品免费播放| 亚洲高清三级视频| 欧美一区二区在线免费观看|