[译]Chipmunk教程 - 7评估数值

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的重力效果,我们需要进行如下设置:

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

 

现在运行模拟器,就会发现球体已经能够在和地板接触,弹起来了。

Conclusion 结论

 

 

虽然灵活并且简单的使用Chipmunk的话,还需要一些时间和努力来理解踏实怎么样工作的,还有一起他的概念。在这个教程中,我希望大家能够对以下这几个概念有非常深刻的认识:space,bodies,shapes.

关于forces,碰撞检测,连接等,还有很多要说的,我期望能够在后续的日子里,继续这样的话题。

posted @ 2010-04-01 22:44  AlexLiu  阅读(830)  评论(0编辑  收藏  举报