移動先: 概要 戻り値 フラグ. MEL 例.

概要

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

objectCenter は 「元に戻す」が可能、「照会」が不可能「編集」が不可能 です。

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

戻り値

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

フラグ

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

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : 1 つのコマンドで複数回使用可能なフラグ

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 //