Plane/平面

PlaneConstraint は、動く側の接続点を基準となる平面上に保ちます。その面に沿う移動や回転は可能です。平面の向きは Attachment0 の主軸で決まります。主軸は面に対して垂直です。

動きの例

Studioで試す

新しいBaseplateを開き、ServerScriptService に Script を作って次のコードを入れ、Playで試します。

local anchor = Instance.new("Part")
anchor.Name = "Anchor"
anchor.Size = Vector3.new(1, 1, 1)
anchor.Position = Vector3.new(0, 10, 0)
anchor.Anchored = true
anchor.Parent = workspace
anchor.CanCollide = false

local block = Instance.new("Part")
block.Name = "Block"
block.Size = Vector3.new(2, 2, 2)
block.Position = Vector3.new(4, 10, 0)
block.Parent = workspace

local a0 = Instance.new("Attachment", anchor)
a0.Orientation = Vector3.new(0, 0, 90)
local a1 = Instance.new("Attachment", block)

local plane = Instance.new("PlaneConstraint")
plane.Attachment0 = a0
plane.Attachment1 = a1
plane.Parent = anchor

block.AssemblyLinearVelocity = Vector3.new(0, 0, 8)

Roblox公式の PlaneConstraint リファレンス

動作を確かめる

例では Attachment0 の主軸が上を向くので、平面は水平です。プレイすると、BlockはZ方向に移動しながら高さを保ちます。平面を傾けたい場合は Attachment0 の Orientation を変更します。Attachment1 の向きは平面の向きに影響しません。

パーツをつなぐ制約の一覧に戻る