0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Roblox】ピボット と Position を理解する:パーツを狙った場所に重ねる3つの方法

0
Last updated at Posted at 2026-03-08

はじめに

Roblox Studio で、あるパーツを別のパーツの位置にスクリプトで移動させようとしたところ、思った場所にピッタリ合わないことがありました。
原因を調べていく中で、「ピボット」と「パーツの中心(Position)」、そして PivotOffset の関係をきちんと意識できていなかったことに気づきました。

本記事では、ピボット と Position の違いを、実際のパーツ配置の例と簡単なスクリプトを使って整理します。
「どの基準点を重ねたいのか」を意識できるようになると、狙った位置への配置がぐっとやりやすくなります。

スクリプト実行前の位置関係

ピボットの位置とパーツの中心位置には、Attachment (黄緑の球体)を表示しています。
ここでの「パーツの中心」はバウンディングボックスの中心を意味しています。バウンディングボックスの範囲は、SelectionBox を使って見えるようにしています。

移動させるパーツ
パーツ(AxisGizmo) の左下手前にピボットがあります。
スクリーンショット 2026-03-08 181038.png

移動先のパーツ
パーツ(apple01)の底面中央にピボットがあります。
スクリーンショット 2026-03-08 181119.png

2つのパーツの位置関係
image.png

🍎ピボット 同士を一致させる

移動させるパーツの ピボット を、移動先パーツの ピボット に重ねます。
PivotTo() は位置だけでなく回転(向き)も完全に一致させる点が特徴です。

local folder = script.Parent
local movePart = folder.AxisGizmo  -- 移動させたいパーツ
local targetPart = folder.apple01  -- 移動先のパーツ

-- 💡 ピボット(回転軸や基準点)の位置と向きを完全に一致させる
movePart:PivotTo(targetPart:GetPivot())

パーツのピボットが、りんごの底面中央に位置します。
スクリーンショット 2026-03-08 183752.png

🍎Position を相手の ピボット に一致させる

移動させるパーツの 中心(Position) を、移動先パーツのピボットに重ねます。

-- 💡 パーツの中心を、相手の基準点(Pivot)に持っていく
movePart.Position = targetPart:GetPivot().Position

パーツの中心が、りんごの底面中央に位置します。
スクリーンショット 2026-03-08 184553.png

🍎Position 同士を一致させる

移動させるパーツの 中心(Position) を、移動先パーツの 中心(Position) に重ねます。
PivotOffset が設定されていても無視されます。直感的に、ど真ん中に置くことができます。

-- 💡 お互いの中心を一致させる
movePart.Position = targetPart.Position

パーツの中心とりんごの中心が完全に一致します。
スクリーンショット 2026-03-08 185013.png

まとめ

ピボット と Position は見た目では似ていますが、スクリプト上ではまったく異なる基準点です。今回のように「重ねたい基準」を意識すると、思い通りの位置調整がしやすくなります。

参考

公式リファレンス

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?