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

天行健 君子當自強而不息

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>
            亚洲视频在线二区| 午夜天堂精品久久久久| 一区二区三区四区精品| 午夜一区不卡| 欧美91视频| 亚洲欧美美女| 欧美精品亚洲一区二区在线播放| 国产精品美女一区二区| 亚洲国产激情| 西瓜成人精品人成网站| 亚洲自拍偷拍一区| 韩国视频理论视频久久| 亚洲色图在线视频| 欧美粗暴jizz性欧美20| 亚洲综合首页| 精品动漫3d一区二区三区免费| 99国产一区二区三精品乱码| 久久久夜精品| 午夜欧美大尺度福利影院在线看| 欧美成人一区二区三区| 激情久久久久久久| 亚洲国产视频a| 久久精品国产96久久久香蕉| 亚洲伦理精品| 欧美成人一区二区在线| 亚洲一区二区三区四区视频| 欧美黄色一区| 欧美a级一区二区| 亚洲电影专区| 中文精品视频一区二区在线观看| 欧美经典一区二区| 欧美一区亚洲一区| 午夜精品国产更新| 国产日本亚洲高清| 久久精品欧美日韩| 欧美国产成人在线| 日韩一级大片在线| 欧美一区永久视频免费观看| 国产三区精品| 久久精品综合网| 欧美一区二区三区四区夜夜大片 | 久久亚洲国产成人| 欧美中文字幕在线| 一本色道久久99精品综合| 日韩视频二区| 国产精品久久久久免费a∨大胸| 久久青草欧美一区二区三区| 欧美日韩中文| 小处雏高清一区二区三区| 免费不卡欧美自拍视频| 亚洲精品美女| 一区二区免费在线播放| 国产精品日韩一区| 久久在线精品| 国产日韩欧美日韩大片| 亚洲午夜视频在线观看| 日韩午夜激情| 麻豆成人综合网| 久久中文精品| 国产亚洲人成a一在线v站 | 亚洲福利精品| 欧美一区午夜精品| 久久爱www久久做| 久久天堂精品| 亚洲一区二区三区视频播放| 欧美成人精品三级在线观看| 欧美va亚洲va香蕉在线| 精品51国产黑色丝袜高跟鞋| 亚洲欧美在线播放| 欧美在线视频免费| 国产日韩精品在线| 欧美在线综合| 久久综合久久综合久久| 激情久久久久久久| 久久综合色综合88| 午夜精品影院在线观看| 国产精品vvv| 亚洲国产另类久久精品| 亚洲国内自拍| 欧美一区二区大片| 久久―日本道色综合久久| 国产亚洲欧美激情| 久久9热精品视频| 美女在线一区二区| 国产女主播视频一区二区| 午夜精品久久久久久久久久久| 欧美怡红院视频一区二区三区| 国产人成一区二区三区影院| 久久精品成人| 欧美在线播放高清精品| 国产亚洲亚洲| 欧美大片在线影院| 中文欧美在线视频| 久久免费视频这里只有精品| 亚洲国产精品免费| 欧美日韩国产成人在线91| 欧美福利影院| 一区二区三区高清在线观看| 国产精品理论片在线观看| 欧美伊人久久久久久午夜久久久久| 麻豆久久婷婷| 在线不卡a资源高清| 欧美一区二区三区四区在线观看| 久久五月婷婷丁香社区| av不卡在线观看| 国产情人节一区| 欧美国产精品久久| 午夜视频一区在线观看| 亚洲福利视频专区| 亚洲人久久久| 欧美日韩成人在线播放| 午夜精品区一区二区三| 亚洲激情国产| 亚洲精品久久久久久一区二区 | 暖暖成人免费视频| 一区二区成人精品| 欧美成人国产一区二区| 亚洲欧洲av一区二区| 亚洲国产一区二区三区a毛片| 欧美日本中文| 美女免费视频一区| 午夜在线一区二区| 亚洲视频在线播放| 亚洲茄子视频| 午夜精品久久久久久久| 亚洲人成网站影音先锋播放| 国产日韩欧美在线视频观看| 欧美日韩成人综合| 欧美jizz19性欧美| 久久久久一区二区| 亚洲国产精品久久久| 久久精品国产久精国产爱| 在线综合视频| 亚洲精品免费网站| 亚洲日本中文字幕免费在线不卡| 国语自产精品视频在线看抢先版结局 | 久久激情综合网| 亚洲一区中文| 欧美11—12娇小xxxx| 久久不射中文字幕| 欧美一区二区大片| 欧美在线视频免费观看| 亚洲欧美三级伦理| 亚洲女同同性videoxma| 亚洲福利视频在线| 精品91视频| 在线精品国产欧美| 国产精品久久久久国产a级| 欧美专区日韩专区| 欧美一区二区在线视频| 欧美一级黄色录像| 欧美制服丝袜第一页| 欧美一区二区日韩| 久久er精品视频| 久久久91精品国产| 亚洲免费人成在线视频观看| 亚洲一区国产视频| 欧美一级在线视频| 久久亚洲精品伦理| 欧美成人日韩| 欧美午夜片欧美片在线观看| 国产精品一区二区在线观看| 欧美日本精品一区二区三区| 欧美一区日韩一区| 久久网站免费| 欧美好吊妞视频| 国产精品二区在线观看| 国产人成精品一区二区三| 韩国精品在线观看| 日韩一区二区精品葵司在线| 正在播放欧美视频| 久久成人精品视频| 欧美国产欧美亚洲国产日韩mv天天看完整 | 欧美一区二区三区视频| 久久久久久亚洲精品杨幂换脸 | 国产精品一二| 激情久久久久久| 亚洲最新在线视频| 久久精品毛片| 亚洲动漫精品| 国产精品99久久久久久白浆小说| 销魂美女一区二区三区视频在线| 久久狠狠亚洲综合| 欧美精品国产一区二区| 欧美午夜精品久久久久久超碰| 国产日韩欧美一区二区三区在线观看 | 国产一区二区毛片| 亚洲精品综合在线| 亚洲人成毛片在线播放| 中文av一区二区| 久久影视三级福利片| 在线午夜精品| 麻豆精品国产91久久久久久| 国产精品免费电影| 日韩亚洲精品电影| 久久青草欧美一区二区三区| 一区二区三欧美| 欧美v国产在线一区二区三区| 国产精品免费看片| 亚洲天堂网在线观看|