Skip to content

How to transform a graph of nodes mid-simulation without making it explode? #350

@trusktr

Description

@trusktr

How can we, for example, pause the "cloth" simluation in the joints example (the grid of spheres), instantaneously rotate and translate the whole thing, then make it resume as if it had already been in the new position and orientation?

The problem I'm having is it is easy to create node graphs for certain use cases (such as a cloth), but then it is very difficult to transform them after the fact (nodes being suddenly "teleported" make it go haywire).

One solution is to create all bodies up front before physics starts. But the use case I'm after is transforming a body node graph mid-simulation.

For example, imagine in a game editor there's a flag waving in the wind. You click and drag to move it to a new location. While you are dragging, the physics on the bodies is paused. When you let go, the physics resumes exactly as if the flag was already in that new location.

What currently happens is if I transform a parent joint to move the flag, the flag cloth goes haywire. Obviously this is expected because a simple translation of the parent to a distant spot is like making it teleport and the engine is trying to accomodate the new constraints. But even if I translate/rotate all the bodies, it still goes haywire, so I think I am missing something.

What are all the things that need to be updated?

  • joint directions? (delete and make new joints?)
  • body velocities?
  • body/joint angular velocities?
  • etc?

Specifically, let's say that we're only transforming the cloth in the joints example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions