0
$\begingroup$

I'm starting with a rigged engine model and would like to use geometry nodes to drive this model. The model works by rotating the crank shaft and using a combination of parenting and constraints everything else follows.

enter image description here

I'd like to use GeoNodes to do some calculations, then set the rotation of the the crank object. I tried using the following GeoNodes setup, but it does not rotate the object. It just moves the mesh.

enter image description here

How can I set the desired rotation using GeoNodes and have it drive a rigged model?

The model is located here -

Note original rigged engine model obtained from BlendSwap - https://blendswap.com/blend/14129

$\endgroup$
3
  • $\begingroup$ Thats not what Sample Index is meant for. Its meant for getting a value from a specific geometry element index, like a specific vert or face etc. You want the rotation of the input geometry to be driven by the x rotation of the object in the Object Info node? $\endgroup$
    – Jakemoyo
    Commented Aug 29 at 13:47
  • 1
    $\begingroup$ The left half of the geonodes is based on spreadsheet importer pluging (see github.com/simonbroggi/blender_spreadsheet_import). The index is how the CSV values are referenced in that plugin. $\endgroup$
    – Ed Tate
    Commented Aug 29 at 13:55
  • 2
    $\begingroup$ GN works in the "realm" of Edit Mode, not in the realm of Object Mode. This means that you can change the mesh (number of vertices, edges, faces ; position of vertices ; materials ; ...) but you can not change the origin position in world coordinates, neither rotate the object local axis. You can only move the vertices such that they are at the position/orientation you are expecting from the origin and axis of the object to which the GN modifier is attached. $\endgroup$ Commented Aug 29 at 16:19

1 Answer 1

1
$\begingroup$

(Using Blender 4.2.1)

This proposal is an adaptation of the post Passing GeoNodes attribute to Shader frame offset.

Approach

One way to proceed is to set up 3 parts:

  • The original object (named "@Crank") with no GeometryNodes modifier, but instead with a Driver controlling its property Transform - Rotation X.
  • A single vertex mesh (named "@Crank Coder") whose X position is set by the GeometryNodes modifier originally attached to the "@Crank" object.
  • An Empty (named "@Crank Driver") making the communication between the two previous objects
    • by copying the "@Crank Coder" position (read/pull/receive),
    • by providing the value of the rotation angle to the "@Crank" Driver (write/push/send).

Crank Coder set up

GN Graph coding the crank angular position 1. In Object Mode, add an object made of one vertex using the menu entry Add>Mesh>Single Vert>Add Single Vert. Its position is irrelevant. Because only one value is coded, one vertex is enough.
2. Add a GeometryNodes modifier to this object. Then copy & paste the nodes of the original "Move crank" graph.
3. Replace the Transform Geometry node with a Set Position node.
4. At this stage, the X coordinate of this vertex is equal to the targeted angle of the crank shaft animated with the Frame number. However, it is to notice that only the position of the vertex is updated. The object's origin remains at its creation location defined at step 1. To use this vertex as a moving point in the definition of a constraint, the documentation explains that "(...) the constraint will target the median point of this vertex group instead of the object’s origin".
5. Consequently in Edit Mode, in the Object Data Properties panel, add a Vertex Group (named "Crank Coder") and Assign after selecting it the single vertex to this group. With only one point, the group median point is this point.

Crank Driver set up

Crank driver constraints 6. Add an empty object using the menu entry Add>Empty>Sphere. Its position is irrelevant.
7. Add a Copy Location constraint to this object. Set the Target to the "@Crank Coder" object created at step 1, then the Vertex Group to the "Crank Coder" group created at step 5.
8. At this stage, the animation shows the empty sliding along the X axis, colocated with the moving vertex.

Crank set up

Crank main set up with driver editor 9. In the Object Properties panel, press RMB over the Rotation X property then select the menu entry Add Driver.
10. In the Drivers Editor, rename the variable to "angle" for example. Set the empty as driving Object (i.e. "@Crank Driver" here).
11. Check that Type is set to "X Location" (the coordinate chosen to encode the crank shaft angle in the GeometryNodes modifier at step 3), and that Space is set to "World Space".
12. Play the animation.

Resources


(Blender 4.2.1+)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .