ios - SpriteKit: Rotating SKNode falls off screen when adding another physics body -


the code below causes rotatelayer physics body fall off screen after few seconds. commenting out circle physics body, however, keeps rotatelayer on screen. not possible add physics body node, , rotate parent node? conceptually, goal rotate circle around fixed point, as described here, attach physics body circle while controlling rotation through angular velocity opposed zrotation.

let size = cgsize(width: 10, height: 250) rotatelayer = sknode() gamelayer.addchild(rotatelayer)  let circlesize = cgsize(width: 10, height: 10) let circle = skspritenode(color: skcolor.whitecolor(), size: circlesize) circle.position = cgpoint(x: 0, y: size.height/2 + circlesize.height/2) circle.physicsbody = skphysicsbody(rectangleofsize: circlesize) circle.physicsbody?.affectedbygravity = false circle.physicsbody?.friction = 0 circle.physicsbody?.lineardamping = 0 circle.physicsbody?.angulardamping = 0 circle.physicsbody?.collisionbitmask = 0 circle.physicsbody?.dynamic = false  rotatelayer.addchild(circle)  rotatelayer.physicsbody = skphysicsbody(rectangleofsize: size) rotatelayer.physicsbody?.affectedbygravity = false rotatelayer.physicsbody?.friction = 0 rotatelayer.physicsbody?.lineardamping = 0 rotatelayer.physicsbody?.angulardamping = 0 rotatelayer.physicsbody?.angularvelocity = -3.0 

adding rotatelayer.collisionbitmask = 0 fixed problem. no clue why.


Comments

Popular posts from this blog

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

java - Incorrect order of records in M-M relationship in hibernate -