Notifications
Clear all

[Closed] Orientation constraint

Some way to be able to automate this kind of manual work, each object that contains orientation constraint its target object to be 2 bones of the bone hierarchy

Sample Scene

4 Replies

This code assumes the bones and points are properly named for sorting them.
Select the bones and points you want to rig and run the code.

Note: The code is based on the sample scene.

(
	points = #()
	bones  = #()
	
	for j in selection do
	(
		if iskindof j point then append points j.name else append bones j.name
	)
	
	sort points
	sort bones
	
	for j = 1 to points.count do
	(
		controller = orientation_constraint()
		
		pt = getnodebyname points[j]
		pt.rotation.controller = controller
		
		if j > 1 and j < points.count do
		(
			bn = getnodebyname bones[j-1]
			controller.appendTarget bn 50.0
		)
		
		bn = getnodebyname bones[j]
		controller.appendTarget bn 50.0
	)
)

It’s excellent, thank you very much!
One question… you may be able to add 2 bones in the list of each driver as you can see in the image I posted

Sorry, I missed that from the .gif.
I’ve updated the code. It should now add two bones.

It’s awesome! Thank you very much.