Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a demo project #1

Open
Felizolinha opened this issue Feb 17, 2020 · 7 comments
Open

Add a demo project #1

Felizolinha opened this issue Feb 17, 2020 · 7 comments

Comments

@Felizolinha
Copy link

A demo project would be really useful to understand how to use the pod. I did all the steps on the README and I still can't make it work :/

@knightcode
Copy link
Owner

@Felizolinha can't get it to work how? What's happening for you?

@Felizolinha
Copy link
Author

The nodes simply stay on top of each other. I made them draggable to help me understand what was happening and, after dragging, they at least move slowly to the center, but still get on top of each other. Also, the nodes seem to only push some of the other nodes, not all of them.

@knightcode
Copy link
Owner

@Felizolinha It might be that the centering force is overpowering the charge on each node. I'll get you the values I'm currently using later today.

@knightcode
Copy link
Owner

@Felizolinha I do:

        node.physicsBody = SKPhysicsBody(circleOfRadius: 100.0)
        node.physicsBody?.isDynamic = true
        node.physicsBody?.affectedByGravity = true
        node.physicsBody?.charge = 5.5
        node.physicsBody?.linearDamping = 1.3
        let spring = SKPhysicsJointSpring.joint(withBodyA: srcNode.physicsBody!, bodyB: destNode.physicsBody!, anchorA: srcNode.position, anchorB: destNode.position)
        spring.damping = 10.0
        spring.frequency = 3.00

and

         self.fdGraph = ForceDirectedGraph(bounds: bounds,
                                           nodes: nodes,
                                           theta: 0.5,
                                           //max: 30.0,
                                           center: center,
                                           centeringStrength: 0.0005)

@Felizolinha
Copy link
Author

Unfortunately this didn't solve the issue, the problem persists :/

@knightcode
Copy link
Owner

It's a delicate balance between the charge and the centeringStrength. Have you tried no centering? (set center to nil)

@TerenzeY
Copy link

TerenzeY commented Feb 13, 2021

Would it be possible to share a demo project with the scene? @knightcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants