I drew a circle in UIView
with a help of UIBezierPath
. Then I added gravity behavior to that view using UIGravityBehavior
and collision behavior using UICollisionBehavior
. When the circle collides with other objects this view bumps as square, but I want to work with this view in collisions as with a circle. How can I do it?
You can't use UIKit Dynamics to simulate a circle. It works with rectangular bodies only. You can add collision paths, but I think that is only for the reference frame. I recommend looking at SpriteKit's SKPhysicsBody
. Unfortunately, I haven't used it, so I can't provide a code sample.
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.