Tracking Pointers in Fologram

I’m using the script from the post - This drawing tool lets you markup physical objects in augmented reality with Fologram - to track lines I draw in space and on my hololens. I have both devices connected to grasshopper, and can draw in both of them. I want to then make the geometry draggable and clickable in grasshopper, but when I go to grab a line it’s still tracking my movements instead of grabbing the object. Are there any good workaround for this? The same issue happens with this measuring tape script - Discover how to make your own measuring tape tool in mixed reality.

In addition, the one of the Stategates in the script has a 4th “lost” output below “press”, “Drag”, and “release”, and I can’t figure out it’s purpose and why that resets tracked points whereas a separate state gate resets and clears the curves.

Hey @danisz welcome to the forum. Quite a few interesting questions you have here!

  1. What does the Lost output on the state gate do:

The ‘Lost’ state occurs when the HoloLens can no longer see a hand that it was previously tracking. E.g. if you hold your hand up in front of you and then move it behind your back, you will get the ‘Lost’ state.

In the 2.28_DrawMultipleCurves example we use this state to reset the list of control points for the current curve. It’s effectively a way of erasing any curve you are in the middle of drawing and can be used if you decide you don’t like what you’re making and want to start again. It also means you don’t get weird control points in your curve if you accidentally lose tracking of your hand.

The separate State Gate with the Clear Curves button resets the list of curves that have been drawn (but doesn’t reset the control points of whatever curve you are currently drawing). So they serve two different purposes: resetting whatever curve you’re currently drawing, and resetting every curve that has been drawn previously.

  1. Pressing buttons while drawing curves:

This is a limitation of how Fologram works. The Track State component will update whenever you press / drag / release regardless of what you are pressing / dragging on. This means if you press a button in the Parameters panel or grab a bit of geometry in your model you will also trigger anything that uses a press event in your grasshopper definition.

The best way to get around this limitation is to add multiple ‘modes’ to your app… more on this below:

  1. Selecting and Moving objects you have drawn:

You can’t select and move curves with Fologram so this is the first hurdle to overcome here. You will need to make mesh pipes from your curves and select / move those.

However this is a bit tricky if we are only using Grasshopper and global variables because while it is possible to grab and move synchronized objects with Fologram, these changes are overwritten if you make any changes to the input to the Sync object component. A better solution for this functionality would be to bake your objects to Rhino instead of storing them in a global variable component, and then you can use normal Fologram for Rhino functionality to grab these and move them around. It makes it more difficult to delete objects (you would need to find objects on a layer and delete them rather than just resetting the input to a global variable like we do now) but otherwise it is much simpler.

  1. Drawing Mode + Select / Move Mode:

The definition your using could be thought of as being just one mode in a larger app / gh definition that also includes whatever other functionality you like. E.g. we could have a drop down list in grasshopper that lets us choose between Drawing and Moving, and when Drawing is selected we have a state gate that runs your current definition, while when Moving is selected the state gate runs an entirely different collection of components.

An example of the definition that bakes objects to Rhino and has a switch between drawing and Editing mode is attached. Editing mode is pretty simple since it is just in Rhino.

Draw and Move (12.5 KB)

Hope that helps!