利用Box2D+WCK賦予Flash物理特性 萬有引力

這已經是第五篇Box2D+WCK的介紹文章了,前面幾篇文章如果各位有注意應該會發現,所有範例的萬有引力都跟現在我們生活的環境一樣,物件像是被地心引力給吸引著都會往下方掉落,其實我們在使用這個模組的時候,也可以改變這樣的萬有引力,讓這些物件不要往下掉落而是往我們所指定的方向移動,馬老師在這邊大概製作了三種不同類型的萬有引力範例,分述如下:

1.容器型萬有引力:這個萬有引力是利用一個封閉的空間來繪製的。

Capsule Gravity

大概的製作步驟如下:

我們可以在World元件中繪製一個如下圖的形狀:

Capsule Gravity Zone

接下來將他轉換成一個影片片段,在類別的部分輸入gravity.GravityCapsule的名稱,如下圖所示:

Capsule Gravity Symbol

接下來把這個元件拖曳到World元件裡面就可以了。

2.放射狀萬有引力:這種萬有引力是以往內或往外放射狀的方式存在。

Radial Gravity

我們可以在World元件中繪製一個如下圖的形狀:

Radial Gravity Zone

接下來將他轉換成一個影片片段,在類別的部分輸入gravity.GravityRadial的名稱,如下圖所示:

Radial Gravity Symbol

接下來把這個元件拖曳到World元件裡面就可以了。

3.正弦萬有引力:就是三角函數的sin。

Sine Gravity

我們可以在World元件中繪製一個如下圖的形狀:

Sine Gravity Zone

接下來將他轉換成一個影片片段,在類別的部分輸入gravity.GravitySine的名稱,如下圖所示:

Sine Gravity Symbol

接下來把這個元件拖曳到World元件裡面就可以了。

同樣的也讓大家可以下載以上的三個範例檔,範例檔為CS5格式,下載後要重新設定來源路徑和元件庫路徑喔!希望這個範例對大家有所幫助,如果還有疑問,也可以在這邊回應唷~

You may also like...

5,341 Responses

  1. sitemap.xml表示:

    Excellent, what a eblog itt is! Thiss webssite givves useful fcts too
    us, keesp itt up.

  2. sitemap.xml表示:

    I ddo nott even know howw I ended upp here, but I thought tuis ost wass great.
    I don’t knolw whho you are but certainly you’re going to a
    famous blogger iff you are nott alreay 😉 Cheers!

  3. sitemap.xml表示:

    Evewryone loves whqt yyou guys tend to bbe up too.
    Succh cleve wrk andd reporting! Keep up tthe suprb work guys I’ve added you giys to my blogroll.

  4. sitemap.xml表示:

    We arre a bunch of vounteers andd opening a neew scheme in our community.

    Your web site provided uus withh useful info too work on. You’ve done aan impressive process aand oour entkre community will likely be thanjkful too you.

  5. sitemap.xml表示:

    Heyy there, I think youur websote might bee having browser
    compatibillity issues. When I look aat your website iin Firefox, it
    looks fine bbut when olening in Internt Explorer, it
    hhas soime overlapping. I just wanted tto give you a qick heads up!
    Other then that, superb blog!

  6. sitemap表示:

    Great website you have here but I was wondcering if you knew off
    anyy uuser discussioon foums that cover the same topics talked
    aboht here? I’d really lik tto be a part off community where
    I can get suggestions from other experienced people that sharre the
    samee interest. If youu have any recommendations, please lett me know.
    Kudos!

  7. sitemap表示:

    Excrptional post however I wass wondeting iif you could write a litte mopre oon thius topic?
    I’d be very gratefu iif you coujld elaborate a littpe bit further.
    Manny thanks!

  8. best coffee pererenan

  9. I like to spend my free time by scanning various internet resources. Today I came across your website and I found it has some of the most practical and helpful information I’ve seen.

  10. These are some of the most important issues we’ll face over the next few decades.

  11. Just wanna admit that this is extremely helpful, Thanks for taking your time to write this.

  12. I don’t normally comment but I gotta say appreciate it for the post on this one : D.

  13. bitcoincasino表示:

    I’m writing on this topic these days, bitcoincasino, but I have stopped writing because there is no reference material. Then I accidentally found your article. I can refer to a variety of materials, so I think the work I was preparing will work! Thank you for your efforts.

  14. thank, I thoroughly enjoyed reading your article. I really appreciate your wonderful knowledge and the time you put into educating the rest of us.

  15. I do not even know how I ended up here, but I thought this post was good. I do not know who you are but certainly you are going to a famous blogger if you are not already 😉 Cheers!

  16. I don’t know if it’s just me or if everybody else experiencing issues with your site. It appears as though some of the written text on your content are running off the screen. Can someone else please provide feedback and let me know if this is happening to them as well? This could be a problem with my web browser because I’ve had this happen before. Appreciate it

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。