RigidBody Goal for custom Object

Hello, does anyone tried or knows how to pass an object to the Kangaroo solver other than a mesh? I currently have a custom class that encapsulates a few sets of geometry data and implements the Tranform() method. I would Ideally want to move it just with this method. I saw also some examples of custom goals but non had similar thing like the Rigid body object.

Hi @ankere

Can you clarify some more about what it is you want to do?
To transform any geometry to the plane of a rigid object from the Kangaroo solver you don’t necessarily need a custom goal.
RigidBody and RigidPointSet both have an output which gives the plane of the object, and using this with Show you can get the updated location/orientation of this from the solver output and then orient any other geometry to it like this:
orient_with_rigid_object.gh (9.0 KB)

1 Like

Thanks so much Daniel! That works wonders.

I was doing something similar but had problems because I’m trying to assemble a dome from some tree forks and straight branches so I had issues with my approach with the non forked data:

  Plane init = Plane.Unset;
  Plane end = Plane.Unset;
  if (initPts.Count == 2)
    init = new Plane(initPts[0], new Vector3d(initPts[0] - initPts[1]));
    end = new Plane(endPts[0], new Vector3d(endPts[0] - endPts[1]));
    init = new Plane(initPts[0], initPts[1], initPts[2]);
    end = new Plane(endPts[0], endPts[1], endPts[2]);

  IMember mem = members as Moose.IMember;
  mem = mem.Duplicate();
  mem.Transform(Transform.PlaneToPlane(init, end));

  A = mem;

But now it works much better… like it works. The last part is to figure out how to actually make the dome happen :slight_smile:

1 Like

I have another question and I’m sure there is some really easy answer but I’m going for the difficult solution again.

Basically I have 3 points that are input in the solver as part of 3 rigid bodies but I want to make sure the normal vector in the form of a line follows them and stays always oriented to the triangle they form and its Z. Then I want to use this line/vector to measure an angle to other vectors using the Line Line Angle goal and move everything accordingly.

The problem is the lines work fine for smaller scale files as the attached but once I put it in a bigger system it shows offsets. Any ideas why is that?

tri_goal.gh (21.7 KB)

Hi @ankere

Can you explain a bit more about the larger definition this fits into?
If it’s about controlling the triangles’ normals relative to some other line, then it would also be possible without ever explicitly creating this centroid and normal offset point.

Also - I show here how that goal can be simplified
tri_goal.gh (11.2 KB)
Creating an actual mesh isn’t necessary to get the normal and centroid of the triangle - just cross product and average the points directly.

This looks slick! I was thinking of averaging but mindlessly copied my visual definition.

I just have to make a goal that move this normal with the three points and vice versa by moving the normal I want to affect the points.

If I disable the length constraint on the triangle sides then sometimes the cross product and the moved normal would be at angle different from 0 thus probably I get the deviations. Is this something to do with double number operations?

Bump… Just curious if anyone else have any ideas about this one?