Spritekit中的Sticky PhysicsBodies

时间:2014-02-11 23:49:51

标签: xcode sprite-kit skphysicsbody

当一个物理对象与另一个物理对象发生碰撞时,与真实单词不同,它不一定会反弹。我发现,如果一个圆圈以接近切角的角度撞击另一个圆圈或撞击一个移动的物体,它会“粘住”它并向上/向下/跨越物理边缘滑动而不是反弹。

增加物理身体的恢复只会导致非“接近切线”碰撞更难反弹。

有没有人知道这个原因的解决方案?

1 个答案:

答案 0 :(得分:1)

您可以在此处查看不同的属性:

Each individual body also has its own property values that determine exactly how it reacts to forces and collisions in the scene. Here are the most important properties:

•The mass property determines how forces affect the body, as well as how much momentum the body has when it is involved in a collision.
•The friction property determines the roughness of the body’s surface. It is used to calculate the frictional force that a body applies to other bodies moving along its surface.
•The linearDamping and angularDamping properties are used to calculate friction on the body as it moves through the world. For example, this might be used to simulate air or water friction.
•The restitution property determines how much energy a body maintains during a collision—its bounciness.

Other properties are used to determine how the simulation is performed on the body itself:
•The dynamic property determines whether the body is simulated by the physics subsystem.
•The affectedByGravity property determines whether the simulation exerts a gravitational force on the body. For more information on the physics world, see “Configuring the Physics World.”
•The allowsRotation property determines whether forces can impart angular velocity on the body.

这是链接:sprite node properties

如果这些都不起作用,您可以尝试在物理主体上使用usesPreciseCollisionDetection属性