First idea was simple: I wanted to create physics game with small cars doing funny stuff (its a lot of fun to watch bunch of miniature cars falling from everywhere or rolling down the hill in high speed)
So I used this simple car made from 2 circles and 2 squares connected with joints. Simple enough.
After I throw bunch of cars into scene, I added sprite shape tool to see what happens. And after while, I ended with this.
No scripts (except of simple cars spawner), just playing with Sprite Shape tool in play mode.
So I need to figure out how to move Sprite Shape nodes from script.
First there was need to differentiate dynamic nodes from static nodes. So I iterated through Sprite Shape nodes and stored nodes with ShapeNodeType which i wanted to be dynamic into dictionary (key was node index and value was position of that node).
public ShapeTangentMode modeToSelect;
Dictionary<int, Vector3> nodes;
controller = GetComponent<SpriteShapeController>();
spline = controller.spline;
nodes = new Dictionary<int, Vector3>();
for (int i = 0;i<spline.GetPointCount()-1;i++)
if (spline.GetTangentMode(i) == modeToSelect)
Rest was easy: custom index (reflecting index in dictionary) was used to determine which node should be selected(active). Left/Right arrows are moving node index
currentPointerIndex = getNextIndex(currentPointerIndex);
currentPointerIndex = getPrevIndex(currentPointerIndex);
Up/Down arrow keys are changing Y position of node (while clamping height)