[譯]Chipmunk教程 – 7評估數值

來源:互聯網
上載者:User

Evaluating the results 對值進行評估

 

 

所有的代碼和規則都有一個對象,物理模擬器。你可能通過一半的code就已經得到了同樣的準確的結果,但是我們來闡述一下為什麼使用Chipmunk是一個很好的選擇。

  • Try changing the friction of all the floor's shapes from 0.1 to 0.5. Run the code, the fall will now lose more velocity.
  • Try increasing or decreasing the gravity and/or the ball's mass to several different values.
  • Try editing the shapes a bit.

 

最後,你可能已經注意到了,所有的shapes形狀都有他們彈力的屬性,但是他們並沒有在模擬器中生效。為了可以使得模擬器相應space的重力效果,我們需要進行如下設定:

view plaincopy to clipboardprint?
  1. // Add some elastic effects to the simulation  
  2.   
  3. space->elasticIterations = 10;  

 

現在運行模擬器,就會發現球體已經能夠在和地板接觸,彈起來了。

Conclusion 結論

 

 

雖然靈活並且簡單的使用Chipmunk的話,還需要一些時間和努力來理解踏實怎麼樣工作的,還有一起他的概念。在這個教程中,我希望大家能夠對以下這幾個概念有非常深刻的認識:space,bodies,shapes.

關於forces,碰撞檢測,串連等,還有很多要說的,我期望能夠在後續的日子裡,繼續這樣的話題。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.