Home Website Youtube GitHub

Dynamic COG in rigs

Hi,

I’ve been asked in my production for a dynamic Center of gtavity as shown in in this rig at 2:28 th sec.

Does anyone know how to add that functionality. I would be highly helpful.

Thanks in advance

“Dynamic” isn’t really a good word to use in this case. You’ll find a bunch of tutorials for dynamics.

What you can google is “maya animate pivot point” and you should find some tutorials.

The related attributes you can start to play with are:

.rotatePivotX
.rotatePivotY
.rotatePivotZ
.rotatePivotTranslateX
.rotatePivotTranslateY
.rotatePivotTranslateZ
.rotateAxisX
.rotateAxisY
.rotateAxisZ
2 Likes

Thanks @chrislesage

I will look into it.

Here you can see two simple extra alternatives for this. One is using a constraint with an inverse matrix and the other just a simple multiply divide…

https://we.tl/t-9HysXfdoDU

4 Likes

Thanks @Jerome

That’s exactly what I need.

Hey @Jerome ! Do you know if you have the file to check again?

It would be great to try implement in our rigs.

Thanks!

i would be also interested!

Hey @niteshms04 @Jerome ! Do you have some examples to check it again?

Thanks!

Correct me if I’m wrong, but it looks very much like a movable pivot, which can be accomplished relatively easily. I’ve attached a file with a controller and a movable pivot which can be selected from the viewport or pickwalking down.
Movable_pivot file:
https://drive.google.com/file/d/1Chm75H2w8iJru2ONdHlUv1__R3JMt0P-/view?usp=sharing

I use the following script to automate the process of making the pivot (the script is from a class, but can be configured to work as a function.

def movable_pivot(self, *args):
    piv_ctrl = pm.spaceLocator(n=self.prefix + '_piv_ctrl')

    pm.scale(self.scale, self.scale, self.scale, )
    pm.makeIdentity(piv_ctrl, apply=True, t=1, r=1, s=1, n=0)
    DeleteHistory(piv_ctrl)

    pm.delete(pm.parentConstraint(self.get_ctrl(), piv_ctrl))
    pm.parent(piv_ctrl, self.get_ctrl())

    # tools.lock_channels(piv_ctrl, channels=['r', 's'])

    pm.addAttr(self.get_ctrl(), longName='MOVABLEPIVOT', nn='HAS MOVABLE PIVOT',
               at="enum", en='=======')
    pm.setAttr(self.get_ctrl() + '.MOVABLEPIVOT', e=True, channelBox=True)

    pm.connectAttr(piv_ctrl + '.t', self.get_ctrl() + '.rotatePivot')
    pm.connectAttr(piv_ctrl + '.t', self.get_ctrl() + '.scalePivot')
3 Likes

Ohh @nilusss ! Many thanks! I’ll check it as soon as posible!

I was checking the video and the same object to change the pivot you can rotate it. In your example (many thanks again!) One object is to move the pivot, and the control is to rotate and use that pivot no?

Thanks!

Im my example, you use the locator to change the pivot of the main controller.

Yees! And if we connect the rotation with the rotation of the control (or a parent group) we have the same behaviour of the video.It was very helpful, thank you!

1 Like

@gerome could y please re upload so i can have a look at the approach?

thank you

How to use the code, sorry for my ignorance? I saw the example file and it’s awesome! it’s great!