1

我使用 EP 曲线工具创建了一条曲线。然后我尝试使用以下 MEL 命令查询这条曲线的控制点的世界空间坐标:

createNode curveInfo;
connectAttr curveShape1.worldSpace curveInfo1.inputCurve;
getAttr "curveInfo1.cp[*]";

但它只是打印出对象空间中的 cv 坐标,结果如下:

// Result: 0 0 0 1 0 0 2 0 0 3 0 0 //

根据 Maya 文档,“curve”命令可用于查询世界空间位置,以下是文档中的片段:

创建节点曲线信息;

connectAttr curveShape1.worldSpace curveInfo1.inputCurve;

getAttr “curveInfo1.knots[*]”;

// 这个序列创建一个曲线信息节点,将信息节点连接到曲线并使用曲线信息节点查询曲线的节点向量。您可以使用曲线信息节点查询其他属性,例如世界空间 CV 值和弧长。

如何使用“曲线”命令查询世界空间位置?

我也尝试使用“xform”命令,但它似乎不适用于我的曲线。结果是这样的:

xform -q -t -ws curve1;
// Result: 0 0 0 //
4

1 回答 1

2

Easiest way is to use the pointPosition command eg.:

pointPosition -w object.ep[1] 

Point position works with any of the point attributes ep, cv, uv, pt etc. But can only query one point at a time so you need to loop.

Nodes dont have any concept of world or local space coordinates (tough you could transform the space), just raw data coordinates. Knots is not what your looking for tough knots define how the curve is parametrized. In general Maya documentation is a bit hard to read for beginning users because Maya operates on a object accessor model. So command and operations don't necessarily do what you would think they do. Rather many commands are accessors to something, and they only operate on the object they are accessors of. Curve command has no conquerable attributes so it can not be queried.

于 2013-02-27T11:36:49.910 回答