[英]How to Join Two Colliding SKSpriteNodes
If I have two SKSpriteNode
objects, one circle and one square, traveling at each other at high speeds, is there a way to make them stick to each other and stop moving when they collide? 如果我有两个
SKSpriteNode
对象(一个圆和一个正方形)彼此高速移动,是否有办法使它们彼此粘在一起并在碰撞时停止移动? Typically, didBeginContact
method is not fast enough at detecting a collision to set their physics bodies' velocities equal to zero before they've already bounced apart by ~30 pixels. 通常,
didBeginContact
方法在检测到碰撞之前还不够快,无法在物理弹跳约30个像素之前将其物理速度设置为零。 Is there a way I can join the two SKSpriteNodes
? 有没有办法可以加入两个
SKSpriteNodes
? Thanks (: 谢谢 (:
Maybe this is going crazy, but my initial idea is to play around with magnetic fields. 也许这太疯狂了,但是我最初的想法是尝试磁场。 You could make a magnetic field and give one of the bodies some charge and then the physics simulation will naturally try and hold those two things together.
您可以产生一个磁场并给其中一个物体充电 ,然后物理模拟自然会尝试将这两件事结合在一起。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.