Using 6dof API

Can you give me an overview of how to write code applying 6dof forces? For lack of documentation I’ve been learning the K2 API by looking at the code for other goals published, but that repo isn’t being updated and has none of the 6dof goals.

Alternatively: Here’s an overview of what I think I know so far, so that others may learn. Please correct me so they don’t learn the wrong thing :slight_smile:

A Goal has:

  • InitialOrientation (Array of Rhino.Geometry.Plane) is equivalent to PPos, but it seems we have to use both (of the same length) if we want 6dof. Since a Plane has an Origin property, is the position stored twice? Are they synchronized, or is one prioritized? Can we intermix particles using orientation, position, or both in a single goal?

  • Torque (Array of Rhino.Geometry.Vector3d) is equivalent to Move. The vector direction specifies the axis around which we would like to rotate. The magnitude specifies how much rotation would satisfy us (in radians).

  • TorqueWeighting (Array of Double) is equivalent to Weighting. I just copy a goal’s strength into it when a particle should be torqued.

A Particle has:

  • Orientation (Rhino.Geometry.Plane) just like it has Position (Point3d). As with instantiation, I’m unsure how the plane’s origin relates to the particle’s position, and when to use each.

I think the issues leading to my questions have been narrowed down a little.
When I have a 6dof goal and a 3dof goal both instantiating coincident (in space) particles, I’m expecting the solver to merge them, but it is not. I don’t want to have to rewrite every goal to be aware of an Orientation that it doesn’t care about, and make sure they start coincident (in direction) with all other goals. I also notice the built-in goals don’t act this way; the solver merges the particles as expected. What’s the right way to combine these different goal types?