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

天行健 君子當自強而不息

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>
            国产精品一区二区视频| 久久久中精品2020中文| 欧美大片在线观看一区二区| 国产丝袜一区二区| 久久免费视频在线| 久久久久**毛片大全| 国产在线视频欧美| 欧美国产日韩精品| 欧美a级理论片| 国产精品99久久久久久久女警| 亚洲精品欧美日韩| 国产精品嫩草久久久久| 久久精品国产第一区二区三区| 欧美综合国产| 亚洲精品视频免费在线观看| 亚洲激情专区| 国产精品久久久久毛片大屁完整版| 午夜精品久久久久久久蜜桃app| 欧美亚洲日本网站| 在线精品观看| 在线视频免费在线观看一区二区| 国产情侣久久| 亚洲欧洲日韩综合二区| 国产精品尤物| 亚洲国产黄色| 国产伪娘ts一区| 亚洲国语精品自产拍在线观看| 国产精品福利网| 看欧美日韩国产| 国产精品国产a级| 免费成人在线视频网站| 国产精品a久久久久| 毛片基地黄久久久久久天堂| 欧美天堂亚洲电影院在线观看| 久久久五月婷婷| 国产精品成人免费视频| 免费在线播放第一区高清av| 国产精品久久久久秋霞鲁丝 | 国产在线视频欧美一区二区三区| 亚洲电影免费观看高清完整版在线观看| 欧美日韩免费观看一区=区三区| 久久国产精品久久久久久| 欧美精品免费看| 蜜臀99久久精品久久久久久软件| 欧美午夜免费电影| 亚洲国产一区视频| 在线观看国产一区二区| 亚洲综合好骚| 亚洲一二三区视频在线观看| 免费精品视频| 乱中年女人伦av一区二区| 国产精品腿扒开做爽爽爽挤奶网站 | 免费久久久一本精品久久区| 欧美一区二区在线免费观看| 欧美日韩精品免费看| 蜜月aⅴ免费一区二区三区| 国产午夜亚洲精品不卡| 亚洲视频综合在线| 亚洲一区二区三区精品视频| 欧美精品18+| 亚洲国产人成综合网站| 1000部精品久久久久久久久| 久久九九热re6这里有精品| 欧美一区二区三区精品电影| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲国产日韩欧美在线图片| 91久久精品国产91性色tv| 久久女同互慰一区二区三区| 久久久久看片| 伊人蜜桃色噜噜激情综合| 久久不射2019中文字幕| 久久天天躁狠狠躁夜夜爽蜜月| 狠狠色丁香婷婷综合影院| 久久国产精品第一页| 麻豆精品国产91久久久久久| 在线成人av网站| 欧美国产亚洲视频| 99精品国产在热久久| 亚洲欧美综合另类中字| 国产精品一级在线| 久久精品国语| 亚洲国产美女精品久久久久∴| 亚洲美女av电影| 国产精品超碰97尤物18| 午夜一区不卡| 免费美女久久99| 99成人精品| 国产欧美精品一区二区三区介绍| 午夜精品免费| 欧美电影专区| 亚洲一区区二区| 国产一区在线视频| 久久一区二区三区国产精品 | 亚洲午夜精品一区二区三区他趣| 欧美一区二区| 亚洲国产欧美一区| 欧美特黄一级大片| 欧美一区二区三区在线播放| 欧美大片一区二区| 亚洲一区二区三区在线视频| 国产有码一区二区| 欧美大片一区二区三区| 亚洲一区二区欧美日韩| 久久精品一区二区三区中文字幕| 伊人成人在线视频| 国产精品二区在线| 免费成人网www| 亚洲女优在线| 亚洲精选中文字幕| 老司机久久99久久精品播放免费 | 久久久亚洲精品一区二区三区| 亚洲欧洲一级| 国产一区二区三区高清| 欧美精品一区二区三| 久久精品亚洲一区二区| 一本大道av伊人久久综合| 男人的天堂亚洲| 久久精品国产一区二区三区免费看 | 亚洲一区免费观看| 久久福利视频导航| 亚洲欧洲三级电影| 国产精品久久久久影院亚瑟| 久久蜜桃资源一区二区老牛 | 欧美激情亚洲综合一区| 亚洲第一在线综合在线| 亚洲第一网站| 国产婷婷色综合av蜜臀av | 亚洲精品中文在线| 欧美一二三区精品| 亚洲欧洲日韩在线| 国产一区观看| 国产亚洲电影| 国产精品国产精品国产专区不蜜| 久久夜色精品一区| 亚洲一区二区三区成人在线视频精品| 蜜臀av性久久久久蜜臀aⅴ| 久久国产精彩视频| 在线视频日韩| 亚洲欧洲精品一区二区精品久久久| 国产精品视频网址| 欧美日韩国产成人在线91| 免费不卡亚洲欧美| 久久爱另类一区二区小说| 一区二区91| 亚洲精品123区| 欧美大片免费| 亚洲丰满少妇videoshd| 久久香蕉精品| 久久精品视频免费观看| 亚洲欧美自拍偷拍| 尤物yw午夜国产精品视频| 在线观看成人av| 国内外成人在线视频| 国产精品免费网站在线观看| 欧美日韩国产首页在线观看| 欧美成人69av| 欧美精品乱人伦久久久久久| 男人的天堂成人在线| 久久久免费观看视频| 欧美制服丝袜第一页| 亚洲精品一区二区三区四区高清| 亚洲精品久久视频| 最新成人av在线| 亚洲欧洲一区二区三区久久| 亚洲国产免费看| 亚洲电影免费观看高清完整版在线 | 久久这里只有精品视频首页| 久久久久久夜| 美女视频黄免费的久久| 免费成人毛片| 国产精品啊啊啊| 国产精品久久久久国产a级| 国产精品私人影院| 国产亚洲永久域名| 国产精品一区二区视频| 在线观看视频一区| 亚洲精品美女久久久久| 日韩一级大片在线| 亚洲视频一二区| 午夜视频久久久久久| 久久精品五月| 免费在线欧美视频| 亚洲黄色免费| 亚洲视频专区在线| 久久综合五月| 欧美视频精品在线观看| 国产视频精品va久久久久久| 伊人精品成人久久综合软件| 136国产福利精品导航网址应用| 亚洲精品一区二区在线观看| 中国av一区| 久久精品国产综合精品| 亚洲第一主播视频| 欧美呦呦网站| 欧美不卡高清| 国产精品网曝门| 亚洲国产天堂久久综合| 久久久久91| 99亚洲一区二区| 久久精品男女|