Giter VIP home page Giter VIP logo

Comments (3)

epreston avatar epreston commented on May 11, 2024

I'll look at this soon, its a good test case. It looks like we have a graph with A at the centre with all the other letters as nodes that should fan out in a circle. For the moment, you might need to adjust the parameters of the simulation. (the repulsion force between nodes and the tension parameters of the springs to bring it into stability.)

I'm a convert to Erin Catto's "Buddha Springs" concept from his GDC 2011 - Box2D presentation for this class of simulation. (do a quick google search on "physics buddha springs") They are the way forward for this code base.

from psarbortouch.

johndpope avatar johndpope commented on May 11, 2024

Hi Ed,
not sure you got my email - for continuity in discussion I ported (hacked) some of your classes over to use Erin Catto box2d with ccbox2d / physics engine.

https://github.com/jdp-global/CCBox2D-Physics
it's a work in progress.

JP

from psarbortouch.

epreston avatar epreston commented on May 11, 2024

Finally got some time to look at this. A few things;

  • Parameters of the simulation
  • Screen space to normalised simulation space coordinate conversion

Yes, without adjusting the parameters of the simulation (the simulation created by the inbuilt physics engine) it will go crazy. Try setting the mass of node "a" to a higher value if its going to be pulled in random 26 directions of different forces. You could also make node "a" fixed in space with infinite mass.

To get the effect you are looking for, you need to balance out the spring forces, mass of nodes, and dampening coefficient. Light objects with strong spring forces will move quickly. Higher dampening can get that "moving in water" effect.

Also, note that the simulation as a whole (all the notes) will drift and move in its own coordinate space unless one of them is fixed in space. That's is why there is camera like view port to zoom and pan to display all of the nodes. Since the camera moves with the simulation centring on it and zooming so that all nodes are in view

I'm almost certain that the code for translating from "screen space" to normalised simulation space is broken in this code base. Going from normalised simulation to "screen space" looks right. I get some crazy behaviour when tapping to drag nodes as if the values are orders of magnitude off.

Good to hear you're hacking away. Enjoy.

from psarbortouch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.