在具有动画子项的父对象上冻结缩放变换(MAYA MEL/Python脚本) [英] Freeze scale transform on a parent object with animated child (MAYA MEL/Python script)

查看:166
本文介绍了在具有动画子项的父对象上冻结缩放变换(MAYA MEL/Python脚本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有平移和旋转动画的对象层次结构,xyz比例相​​等且是静态的,但不是1.当我在父网格物体上冻结比例时,其子级动画会变得疯狂.有什么办法可以防止这种情况的发生?

I have hierarchy of objects with animation on translation and rotation, the scale xyz are equal and static but not 1. When I freeze scale on a parent mesh it's children's animation goes wild. Is there any way to prevent this from happening?

我找到了一种解决方法,但这还不是完美的.假设我们有这样简单的设置: parentObject => childObject

I have found a workaround, but it's not perfect yet. Let's say we have simple setup like this: parentObject=>childObject

  1. 我将childObject放在了一个"childObjectGroup"组中
  2. 将parentChildObjectGroup移至世界,并将其归零,不包括比例.
  3. 将childObject的变形发布到世界上,这样我们就不再需要组了. (为此找到了一个不错的脚本)
  4. 冻结对parentObject和childObject的缩放比例
  5. 让他们回到过去

它适用于类似这样的简单层次结构,但不确定如何将其应用于具有深树和多个早午餐的更复杂层次结构.可能我缺少了一些东西,对此确实有一个简单的解决方案.

It works for simple hierarchies like that, but not sure how to apply it for more complicated ones with deep tree and several brunches. Probably I'm missing something and there is really simple solution to that.

推荐答案

每次更改父节点的比例时,其子节点的转换都会改变-至少,如果您以世界空间单位进行测量.因此,将父级下的10个单位移动到比例为0.5的位置,实际上将移动5个世界空间单位.

Any time you change the scale of a parent node, the translation for it's children is going to change - at least, if you're measuring in world space units. So, moving 10 units under a parent scaled to 0.5 will actually move 5 world space units (for example).

我很确定您的旋转应该很好,因为缩放比例并不会真正改变围绕枢轴旋转的方式.但是,如果要旋转的轴不在对象中心,并且缩放比例不均匀(xyz并不相等),则压缩空间内部的旋转将更像是一个椭圆而不是一个圆

I'm pretty sure your rotations should be fine since scale doesn't really change how rotation around a pivot works; however, if you're rotating something from a pivot that is not in the center of the object and you have non-uniform scaling (xyz are not all equal) the rotation inside of the squashed space will feel more like an oval than a circle.

如果这不是问题,则主要要担心的是平移位置-您基本上需要获取每个对象在每个关键点处的世界空间位置,固定"比例,然后遍历关键点并设置再次显示世界空间位置(我将使用xform命令,因为您可以查询和设置世界空间值).因此,您概述的步骤可能是最好的选择……

If that's not a problem, the main thing to worry about is the translation positions - you basically need to get the world space positions of each object at each key, 'fix' the scale, then go through the keys and set the world space position again (I would use the xform command for that since you can query and set position with world space values). So, the steps you outlined will probably be the best bet...

但是,如果比例尺不均匀,则实际上可能无法以给您相同结果的方式来计算旋转(仅取决于位置/枢轴和连续的后代位置/枢轴).如果父母的体重秤实际上并没有伤害任何东西,并且不应该对其进行键控/设置动画,则可以锁定并隐藏它而不会产生任何不利影响.

If you have non-uniform scales though, you may not actually be able to get the rotations to work out in a way that gives you the same results (just depending on positions/pivots and consecutive descendant positions/pivots). If the parent's scale isn't actually hurting anything and isn't supposed to be keyed/animated, it might be ok to just lock and hide it without any adverse effects.

这篇关于在具有动画子项的父对象上冻结缩放变换(MAYA MEL/Python脚本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆