Remove Springiness From SCNPhysicsBallSocketJoint

242 views Asked by At

I'm building my first app in Swift and it's based on the bimini ring toss game you see in bars with a ring attached to a string from the ceiling. I'm using a SCNPhysicsBallSocketJoint to connect a bunch of small spheres to act like a string/rope. I've got some early results that are good but the spheres are way too springy in their connection. The repo is here if you want to run it yourself but here's the code for connecting the spheres.

/** Generate our rope links **/
    var cnt:Float = 0.0
    var previousLink: SCNNode = ropeObject.getRope()
    var links :[SCNNode] = [SCNNode]()
    while cnt < 4.0 {
        let link = ropeObject.getLink( y: Float(cnt) )
        links.append(link)

        let joint = SCNPhysicsBallSocketJoint(
            bodyA: link.physicsBody!,
            anchorA: SCNVector3(x: -0.05, y: -0.05, z: -0.05),
            bodyB: previousLink.physicsBody!,
            anchorB: SCNVector3(x: 0.05, y: 0.05, z: 0.05)
        )
        scnScene.physicsWorld.addBehavior(joint)

        previousLink = link
        cnt += 0.1
    }
1

There are 1 answers

0
An Se On

Try to significantly increase mass property of your spheres, it will result less springiness.

Also, Chris, thank you so much for posting this project in your blog, it helped me a lot with my rope-like object.