Notifications
Clear all

[Closed] Create bones to specific points

I can’t find a way to create bones from a central point “master” to other points on scene without having to write in the code each of the points on scene and that way I feel that it’s not efficient, is there a more correct way to do it? thank you.

5 Replies

I am not sure what you are trying to do, but by the look of it you are creating a max bone between the centre point and all the point helpers arrayed along the mesh?
You can use transforms to create the same setup programmatically, as after all the points merely represent transforms in 3D space.
This will create an equaly spread array of 10 bones around the central points X axis, moved out 50 units in the y axis:

-- central transform point, can be swapped out with any objects transform, this represents world zero:
centerTransform = Matrix3(1)
-- the number of points to create:
numPoints = 10.0
-- the length of the bones to create:
boneLength = 50
-- how many degrees apart each bone is:
spread = 360.0 / numPoints
-- the local positional offset of each bone from the central transform:
posOffsetTrans =  transMatrix [0, boneLength, 0]
for a = 1 to numPoints do
(
    
     -- calculate the new rotation value around the central transforms X axis:
    local newRotationTrans = rotateXMartrix ( spread * a ) * centerTransform )
    -- add on the y axis positional offset:
    local endPointTrans = posOffsetTrans * newRotationTrans
    -- create a point to visually represent the transform:
    Point Name:( "Point " + ( a as string) ) Transform:endPointTrans
)

I appreciate your help, but it is necessary that the points are previously created by the user and placed on screen in different places, here I show you an example of what I’m looking to automate.
Thank you very much anyway.

Well if you know the name of the objects before hand, then loop over the names to get the objects:

for objName in objNames do
(
    -- get the node by its name:
    local obj = GetNodeByName objName
    -- access it's transform values:
    obj.Transform.Position
)

If there is a specific naming convention then you can reconstruct each name in the loop:

for a = 1 to objCount do
(
    local objName = "Helper_ + ( a as string )
    -- logic here
)

Or you can select the nodes and loop over selection:

for obj in Selection do
(
    -- logic here
)

just a thought, you can get the same effect without adding the bones, if you set all the points pivot to the center point and then add the points to the skin modifier they will act in the same way.

Thank you!