MrProgrammer
MrProgrammer

Reputation: 29

Gravity with UIview

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?

Screenshot provided

Upvotes: 0

Views: 655

Answers (1)

Zev Eisenberg
Zev Eisenberg

Reputation: 8148

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.

Upvotes: 1

Related Questions