In this tutorial, we will use the geometry of a piston and crankshaft assembly to get to learn how to set up Relations between parametric objects in Archimatix.
In this short tutorial, you will coax a living parametric model to shape shift into different forms. Archimatix ships with a library of such parametric props, ready to stamp out incarnations of themselves to use in your games.
In this tutorial (below), you will learn:
2. How to discover and use parametric Handles associated with parts of the model.
3. Stamp out “frozen” variations of these props.
In this two-part tutorial, you will use 2D Shapes from the Library, such as a Circle and a RoundedRectangle, merge them with a ShapeMerger and then Lathe them to form a large Skyplatform. You will reuse the merged shape to feed into an Extrude Mesher and automatically distribute this Extrude as End Caps for the Lathe.
In this tutorial, we introduce the basics of combining Shapes from the 2D Library to easily create complex forms.After completing this tutorial, you will have learned:
Artful parametric modeling is all about managing relationships. Not the personal kind, but the algorithmic kind.
By defining meaningful relationships among your parameters, you can encode a new and powerful morphological genus – creating a new species DNA, as it were, that can be used to generate hundreds of variations of models.
When you connect parameters to each other, you are authoring behaviors for your parametric model. When you modify one parameter, all sorts of changes may ripple through the model according to the logic you encoded via Relation connections and mathematical expressions within the Relation. Furthermore, these Relations may be bi-directional, meaning that you can change a parameter anywhere in the graph and changes will ripple out from that parameter. The default mathematical expression set when you fist specify a Relation is simply “=,” or equals.
A common case for an equals Relation is when you want one object to always sit atop another, regardless of how tall the bottom object is. In the example to the right, the behavior illustrated is that the blue Cylinder is always atop the red Box.
To set up this parametric behavior:
Transformations of the Cylinder.
You will notice that the relation is bi-directional. Modifying either parameter will alter the related parameter. This is a departure from other parametric modelers which feature uni-directional relations. The benefit of bi-directional is that, when playing with a parametric model in the SceneView, you can click just about anywhere you like and start modifying, rather than searching for the “master” parameter.
However, this freedom is not free: the bi-directionality requires inverse expressions to be input. In the case of our simple example, we did not edit the expression found in th relation, relying on the default equals expression. Let’s take a look at how we might make a slightly more complex relation expression.
When would like to have more interesting Relations, you can use the ExpressionEditorWindow that pops up when you click on the green button at the center of the Relation connector cable. In the ExpressionEditorWindow are two text fields allowing you to edit the bi-directional relationship between the two parameters.
Lets say that we would like to simulate the movement of a piston relative to the rotation of a crankshaft in a car engine. The piston rises and falls sinusoidally as the shaft turns. The expression is Piston.Trans_Y=Sin(Crankshaft.Rot_X). Lets go ahead and set this up:
In the ExpressionEditor, in the field filled in with Crankshaft.Rot_X, change the expression to: Sin(Crankshaft.Rot_X) and then click on the Save button just below.
We will save more elaboration on this with the addition of a piston rod, etc. please see the tutorial The Parametric Engine.
If you find yourself connecting the Trans_X for one node and the Trans_X of another node to the same source, it is probably better to group the two nodes together with a Grouper and then relate the Grouper’s Trans_X to the source. This is analogous to parenting two GameObjects to an “Empty” GameObject in the Unity hierarchy window. While Archimatix can handle lots of relations, by using relation connections where a grouping would do, you will add more visual complexity to the NodeGraphWindow.
For example, the animation to the right depicts a parametric behavior whereby the red Box and the blue Cylinder are always positioned at the end of the gold Box. There are two ways we could encode this behavior:
Method 1: This method is not preferable, but happens commonly while building up a graph. The Trans_X of the Cylinder has been related to the width parameter of the rectangular plan of the gold Box with an expression of Cylinder.Trans_X=Rectangle.width/2. When the red Box was added to the graph, a similar relation was added between the gold Box and the red Box, as shown in the figure to the right. Now when we drag the Handle for the Rectangle width, the blue Cylinder and the red Box translate accordingly.
The down side of this is that we have two connections and we have to enter the same mathematical expression twice (for the Cylinder and for the red Box). If we want to change that relationship, we have to change it in two places. Also, the graph will quickly get cluttered if such translations are maintained with Relation connections all the time.
Method 2: Alternatively, we can feed the Cylinder and Box into a Grouper and then relate the Trans_X of the Grouper to the width of the Rectangle.
The behavior of our parametric model will be exactly the same, but now, if we wish to edit the expression in the relations, we are editing in only one place. Also, the graph will have fewer parametric relations, which tends to make the graph more legible.