简体   繁体   中英

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? 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. Is there a way I can join the two 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM