Terrainクラス

クラスInstance.newでは作れない日本語解説あり

ひとことで言うと

山・水・草原などの地形を表すクラスです。Workspaceの中に1つだけあり、スクリプトで地形を作ることもできます。

公式の説明(英語):Terrain lets you to create dynamically morphable environments.

クラスの関係

受け継いでいるクラス:Object → Instance → PVInstance → BasePart → Terrain

プロパティ(9)

名前と書き方説明
Decoration
Terrain.Decoration: boolean
Enables or disables terrain decoration.
GrassLength
Terrain.GrassLength: float
Specifies the length of animated grass.
MaterialColors
Terrain.MaterialColors: BinaryString
Represents the editor for the **Material Color** feature and cannot be edited by scripts.
MaxExtents
Terrain.MaxExtents: Region3int16
Displays the boundaries of the largest possible editable region.
WaterColor
Terrain.WaterColor: Color3
The tint of Terrain water.
WaterReflectance
Terrain.WaterReflectance: float
Controls how opaque Terrain water reflections are.
WaterTransparency
Terrain.WaterTransparency: float
The transparency of Terrain water.
WaterWaveSize
Terrain.WaterWaveSize: float
Sets the maximum height of Terrain water waves in studs.
WaterWaveSpeed
Terrain.WaterWaveSpeed: float
Sets how many times Terrain water waves will move up and down per minute.

メソッド(24)

名前と書き方説明
CellCenterToWorld
Terrain:CellCenterToWorld(x: int, y: int, z: int): Vector3
Returns the world position of the center of the terrain cell.
CellCornerToWorld
Terrain:CellCornerToWorld(x: int, y: int, z: int): Vector3
Returns the position of the lower-left-forward corner of the grid cell.
Clear
Terrain:Clear(): ()
Clears all terrain.
CopyRegion
Terrain:CopyRegion(region: Region3int16): TerrainRegion
Stores a chunk of terrain into a TerrainRegion object so it can be loaded back later.
CountCells
Terrain:CountCells(): int
Returns the number of non-empty cells in the terrain.
FillBall
Terrain:FillBall(center: Vector3, radius: float, material: Material): ()
球の範囲を、指定した素材の地形で埋めます。Fills a ball of smooth terrain in a given space.
FillBlock
Terrain:FillBlock(cframe: CFrame, size: Vector3, material: Material): ()
直方体の範囲を、指定した素材の地形で埋めます。Fills a block of smooth terrain with a given location, rotation, size, and material.
FillCylinder
Terrain:FillCylinder(cframe: CFrame, height: float, radius: float, material: Material): ()
Fills a cylinder of smooth terrain in a given space.
FillRegion
Terrain:FillRegion(region: Region3, resolution: float, material: Material): ()
Fills a Region3 space with smooth terrain.
FillWedge
Terrain:FillWedge(cframe: CFrame, size: Vector3, material: Material): ()
Fills a wedge-shaped volume of terrain with the given Material.
GetMaterialColor
Terrain:GetMaterialColor(material: Material): Color3
Returns current terrain material color for specified terrain material.
GetMaterialSlot
Terrain:GetMaterialSlot(slotIndex: int): Tuple
Returns the base material, MaterialVariant, and color configured for a material slot.
PasteRegion
Terrain:PasteRegion(region: TerrainRegion, corner: Vector3int16, pasteEmptyCells: boolean): ()
Applies a chunk of terrain to the Terrain object.
ReadVoxelChannels
Terrain:ReadVoxelChannels(region: Region3, resolution: float, channelIds: Array): Dictionary
Returns a region of terrain voxel data in table format based on the channel names.
ReadVoxels
Terrain:ReadVoxels(region: Region3, resolution: float): Tuple
Returns a certain region of smooth terrain in table format.
ReplaceMaterial
Terrain:ReplaceMaterial(region: Region3, resolution: float, sourceMaterial: Material, targetMaterial: Material): ()
Replaces the terrain of a material within a region with another material.
ResetMaterialSlot
Terrain:ResetMaterialSlot(slotIndex: int): ()
Clears a material slot.
SetMaterialColor
Terrain:SetMaterialColor(material: Material, value: Color3): ()
Sets current terrain material color for specified terrain material.
SetMaterialSlot
Terrain:SetMaterialSlot(slotIndex: int, baseMaterial: Material, materialVariant: string, color: Color3): ()
Configures a material slot with a base material, an optional MaterialVariant, and a color.
WorldToCell
Terrain:WorldToCell(position: Vector3): Vector3
Returns the grid cell location that contains the position point.
WorldToCellPreferEmpty
Terrain:WorldToCellPreferEmpty(position: Vector3): Vector3
Returns the grid cell location that contains the position point, preferring empty grid cells when position is on a grid edge.
WorldToCellPreferSolid
Terrain:WorldToCellPreferSolid(position: Vector3): Vector3
Returns the grid cell location that contains the point position, preferring non-empty grid cells when position is on a grid edge.
WriteVoxelChannels
Terrain:WriteVoxelChannels(region: Region3, resolution: float, channels: Dictionary): ()
Sets a region of terrain using a dictionary of voxel channel data.
WriteVoxels
Terrain:WriteVoxels(region: Region3, resolution: float, materials: Array, occupancy: Array): ()
Sets a certain region of smooth terrain using table format.

受け継いでいるメンバー

BasePart から受け継いでいるもの(66)

Anchored・AssemblyAngularVelocity・AssemblyCenterOfMass・AssemblyLinearVelocity・AssemblyMass・AssemblyRootPart・AudioCanCollide・BackSurface・BottomSurface・BrickColor・CanCollide・CanQuery・CanTouch・CastShadow・CenterOfMass・CFrame・CollisionGroup・Color・CurrentPhysicalProperties・CustomPhysicalProperties・EnableFluidForces・ExtentsCFrame・ExtentsSize・FrontSurface・LeftSurface・Locked・Mass・Massless・Material・MaterialVariant・PivotOffset・Reflectance・ResizeableFaces・ResizeIncrement・RightSurface・RootPriority・Rotation・Size・TopSurface・Transparency・AngularAccelerationToTorque・ApplyAngularImpulse・ApplyImpulse・ApplyImpulseAtPosition・BindToCollisionSummaries・CanCollideWith・CanSetNetworkOwnership・GetClosestPointOnSurface・GetConnectedParts・GetJoints・GetMass・GetNetworkOwner・GetNetworkOwnershipAuto・GetNoCollisionConstraints・GetTouchingParts・GetVelocityAtPosition・IntersectAsync・IsGrounded・Resize・SetNetworkOwner・SetNetworkOwnershipAuto・SubtractAsync・TorqueToAngularAcceleration・UnionAsync・Touched・TouchEnded

PVInstance から受け継いでいるもの(4)

Origin・Pivot Offset・GetPivot・PivotTo

Instance から受け継いでいるもの(46)

Archivable・Capabilities・IsInSandbox・Name・Parent・PredictionMode・Sandboxed・AddTag・ClearAllChildren・Clone・Destroy・FindFirstAncestor・FindFirstAncestorOfClass・FindFirstAncestorWhichIsA・FindFirstChild・FindFirstChildOfClass・FindFirstChildWhichIsA・FindFirstDescendant・GetActor・GetAttribute・GetAttributeChangedSignal・GetAttributes・GetChildren・GetDebugId・GetDescendants・GetFullName・GetStyled・GetStyledPropertyChangedSignal・GetTags・HasTag・IsAncestorOf・IsDescendantOf・IsPropertyModified・QueryDescendants・RemoveTag・ResetPropertyToDefault・SetAttribute・WaitForChild・AncestryChanged・AttributeChanged・ChildAdded・ChildRemoved・DescendantAdded・DescendantRemoving・Destroying・StyledPropertiesChanged

Object から受け継いでいるもの(4)

ClassName・GetPropertyChangedSignal・IsA・Changed

英語の説明とメンバーの一覧は、Roblox Creator Documentation(Terrain)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。

執筆:鈴木孝昌官公庁のWeb・システム開発を担当する現役プロジェクトマネージャー。沖縄マイクラ部 クロスウェーブで、ロブロックス(Roblox)・マインクラフト(マイクラ)・Scratchなどのプログラミングを指導。マイクラカップ沖縄代表チームを指導(第6回・第7回、第7回TBS賞)。
沖縄マイクラ部で、子どもたちにロブロックス(Roblox)やマインクラフト(マイクラ)のプログラミングを教えています。プロフィールと編集方針
Instagramで教室の様子を見る
noteで記事を読む