Rubik snake toy

   2467   0   0
User Avatar
Member
30 posts
Joined: Feb. 2018
Offline
Hello. For a long time I wanted to create something by Python in Houdini, and I saw an interesting work in one of Cinema 4D groups in Telegram (https://t.me/learning_xpresso) - the Rubik snake toy, I really liked it and wanted to do something like that.
How it works: here, each element affects the others (FK), but I need to consider the possibility of switching the direction of FK since collecting everything in one direction only will be very inconvenient. To create FK, I used a CHOP network in which I switched between parents using a button (when you click on the button, the offset for the new parent is updated first, then switch nodes are switched).
Using Python, I made copying for a group of nodes and automatically registered paths for parents in CHOP, made a Clear button(delete nodes with a rig) and an Import button (for easy saving)
The algorithm of work with the toy:
- select the element size and the length of the snake (number of elements) and click the Create button - the entire rig will be created automatically (after creating the rig, changing the number of modules will not affect the created rig in any way). Pressing the Create button again will offer to delete the created rig and create it again with the specified number of modules;
- controllers have only one degree of freedom;
- the Change FK direction button changes the direction of forward kinematic;
- Clear button - will delete the created rig and Import button - will make a separate geo node in the same hip file with object merge node in which there will be only toy geometry (merge geometry from all modules);
- the color of the toy can be changed at any time before Import.

The Point only switch allows you to export points with the orient attribute to create your own modules. With the import of points, a node is created with the bounding geometry of one module.






This is not an hda, all Python code is located in the hou.session module. This is the first thing I did with rigging and Python, so I will be glad to any hints or adjustments as it could be made easier, more convenient or more correct.
Edited by PrintScreen - April 23, 2020 11:49:26

Attachments:
Toy_snake.hipnc (497.7 KB)
Snake_1.jpg (225.4 KB)
Snake_2.jpg (184.7 KB)
Snake_3.jpg (169.6 KB)
Snake_4.jpg (135.3 KB)
Snake_5.jpg (155.6 KB)
Snake_6.jpg (143.9 KB)
Snake_7.jpg (182.8 KB)
Snake_8.jpg (146.9 KB)
Camel_pipe_1.jpg (260.9 KB)
Camel_plant_1.jpg (323.3 KB)
Turtle_pipe_1.jpg (253.2 KB)
Turtle_plant_1.jpg (325.3 KB)

  • Quick Links