Chipmunk uses an iterative solver to figure out the forces between objects in the space. What this means is that it builds a big list of all of the collisions, joints, and other constraints between the bodies and makes several passes over the list considering each one individually. The number of passes it makes is the iteration count, and each iteration makes the solution more accurate. If you use too many iterations, the physics should look nice and solid, but may use up too much CPU time. If you use too few iterations, the simulation may seem mushy or bouncy when the objects should be solid. Setting the number of iterations lets you balance between CPU usage and the accuracy of the physics. Chipmunk’s default of 10 iterations is sufficient for most simple games.
(我的见解) chipmunk采用迭代器来计算和解决space里物体之间力的互相作用。这意味着chipmunk为所有物体body之间的相互作用建立了一个很大很大的表,并为每个物体都单独地进行了一定迭代次数地计算。每次迭代都会使计算结果更加准确与真实,更多的迭代次数会使物理效果更加真实,同时花费更多的CPU时间。请适当地定位迭代次数,chipmunk一般默认定义为10次。
(原文)Sleeping
cpSpace.sleepTimeThreshold. If you do not set cpSpace.idleSpeedThreshold explicitly, a value will be chosen automatically based on the current amount of gravity.
cpSpace.sleepTimeThreshold(单位为秒),确保过了这个时间物体能变成"睡眠"状态。如果没设置这个值,chipmunk将自动根据最近的重力值设定?(最后一句是这样理解么。。)
cpFloat cpSpaceGetSleepTimeThreshold(const cpSpace *space)
void cpSpaceSetSleepTimeThreshold(cpSpace *space, cpFloat value)
设置物体的失效时间,单位为秒。默认属性为INFINITY的body无此特性。
浙公网安备 33010602011771号