swift - SKSpriteNode or SKShapeNode for Circular Object -
does have guidance how create spritekit object looks circle circular physics properties? i've considered using skshapenode, yet after reading comments in documentation 1 "the skspritenode class offers higher performance class, use shape nodes sparingly" here https://developer.apple.com/documentation/spritekit/skshapenode, i'm reluctant use skshapenode.
i have code create skspritenode image makes circle...
sprite = skspritenode(imagenamed:spriteimage)
...and i've applied circular physics body...
sprite.physicsbody = skphysicsbody(circleofradius: (width / 2))
i've set properties such allowrotation, affectedbygravity , isdynamic true in physics body...
physics = sprite.physicsbody physics.affectedbygravity = true physics.allowsrotation = true physics.isdynamic = true
the circle skspritenode still behaves square. instead of rolling wheel, object flops square.
cc right. original physics body set circle, @ point in code physics body changed square. fixed part of code , working now. thanks!
Comments
Post a Comment