ジャンプ先: 概要. 戻り値. フラグ. MEL 例.

概要

objectCenter [-global] [-local] [-x] [-y] [-z] object

objectCenter は、取り消し可能、照会不可能、および編集不可能です。

このコマンドは、指定したオブジェクトのバウンディング ボックスの中心の座標を返します。1 つの座標だけを指定した場合、浮動小数点数として返します。座標がまったく指定されていない場合、x、y、z を含む浮動小数点数の配列が返されます。複数の座標を指定した場合、1 つだけが返されます。

戻り値

float[]中心を求められた場合(既定)。
float1 つの座標だけが指定した場合。

フラグ

global, local, x, y, z
ロング ネーム(ショート ネーム) 引数タイプ プロパティ
-global(-gl) create
グローバル座標の位置の値を返します(既定)。
-local(-l) create
ローカル座標の位置の値を返します。
-x(-x) create
X の値だけを返します。
-y(-y) create
Y の値だけを返します。
-z(-z) create
Z の値だけを返します。

フラグはコマンドの作成モードで表示できます フラグはコマンドの編集モードで表示できます
フラグはコマンドの照会モードで表示できます コマンド内でフラグを複数回使用できます。

MEL 例

// create a simple hierarchy
polyCube -name "a";
polyCube -name "b";
parent b a;
move -localSpace 3 0 0 a;
move -localSpace 2 2 2 b;

// Get the world space x coordinate value of object b's center
float $X_COORD = `objectCenter -x b`;
// Result: 5 //

// Get the center of the bounding box of b in local space
float $XYZ[] = `objectCenter -l b`;
// Result: 2 2 2 //

// Get the center of the bounding box of b in world space
float $XYZ[] = `objectCenter -gl b`;
// Result: 5 2 2 //

// Get the center of the bounding box of a in world space
float $XYZ[] = `objectCenter -gl a`;
// Result: 4 1 1 //