PartOperation

非推奨を表示

An abstract class that all parts based on solid modeling inherit from.

概要

プロパティ

TriangleMeshPart から継承した プロパティBasePart から継承した プロパティ
  • 並列読み取り

    Determines whether a part is immovable by physics.

  • 複製されていません
    並列読み取り

    The angular velocity of the part's assembly.

  • 読み取り専用
    複製されていません
    並列読み取り

    The center of mass of the part's assembly in world space.

  • 複製されていません
    並列読み取り

    The linear velocity of the part's assembly.

  • 読み取り専用
    複製されていません
    並列読み取り

    The total mass of the part's assembly.

  • 読み取り専用
    複製されていません
    並列読み取り

    A reference to the root part of the assembly.

  • 並列読み取り

    Determines the type of surface for the Back face of a part (+Z direction).

  • Determines the type of surface for the Bottom face of a part (-Y direction).

  • 複製されていません
    並列読み取り

    Determines the color of a part.

  • 並列読み取り

    Determines the position and orientation of the BasePart in the world.

  • 並列読み取り

    Determines whether a part may collide with other parts.

  • 並列読み取り

    Determines whether the part is considered during spatial query operations.

  • 並列読み取り

    Determines if Touched and TouchEnded events fire on the part.

  • 並列読み取り

    Determines whether or not a part casts a shadow.

  • 読み取り専用
    複製されていません
    並列読み取り

    Describes the world position in which a part's center of mass is located.

  • 複製されていません
    並列読み取り

    Describes the name of a part's collision group.

  • 複製されていません
    並列読み取り

    Determines the color of a part.

  • 読み取り専用
    複製されていません
    並列読み取り

    Indicates the current physical properties of the part.

  • Determines several physical properties of a part.

  • 並列読み取り

    Used to enable or disable aerodynamic forces on parts and assemblies.

  • 読み取り専用
    複製されていません
    並列読み取り

    The CFrame of the physical extents of the BasePart.

  • 読み取り専用
    複製されていません
    並列読み取り

    The actual physical size of the BasePart as regarded by the physics engine.

  • 並列読み取り

    Determines the type of surface for the Front face of a part (-Z direction).

  • 並列読み取り

    Determines the type of surface for the Left face of a part (-X direction).

  • 非表示
    複製されていません
    並列読み取り

    Determines a multiplier for BasePart.Transparency that is only visible to the local client.

  • 並列読み取り

    Determines whether a part is selectable in Studio.

  • 読み取り専用
    複製されていません
    並列読み取り

    Describes the mass of the part, the product of its density and volume.

  • 並列読み取り

    Determines whether the part contributes to the total mass or inertia of its rigid body.

  • 並列読み取り

    Determines the texture and default physical properties of a part.

  • 複製されていません
    並列読み取り

    The name of MaterialVariant.

  • 非表示
    複製されていません
    並列読み取り

    Describes the rotation of the part in the world.

  • 並列読み取り

    Specifies the offset of the part's pivot from its CFrame.

  • 非表示
    複製されていません
    並列読み取り

    Describes the position of the part in the world.

  • 非表示
    読み取り専用
    複製されていません
    並列読み取り

    Time since last recorded physics update.

  • 並列読み取り

    Determines how much a part reflects the skybox.

  • 読み取り専用
    複製されていません
    並列読み取り

    Describes the smallest change in size allowable by the Resize method.

  • 読み取り専用
    複製されていません
    並列読み取り

    Describes the faces on which a part may be resized.

  • 並列読み取り

    Determines the type of surface for the Right face of a part (+X direction).

  • 並列読み取り

    The main rule in determining the root part of an assembly.

  • 複製されていません
    並列読み取り

    The rotation of the part in degrees for the three axes.

  • 複製されていません
    並列読み取り

    Determines the dimensions of a part (length, width, height).

  • 並列読み取り

    Determines the type of surface for the Top face of a part (+Y direction).

  • 並列読み取り

    Determines how much a part can be seen through (the inverse of part opacity).

PVInstance から継承した プロパティ
  • 複製されていません
    スクリプト作成できません
    並列読み取り
  • 複製されていません
    スクリプト作成できません
    並列読み取り

方法

BasePart から継承した 方法PVInstance から継承した 方法

イベント

BasePart から継承した イベント

プロパティ

RenderFidelity

並列読み取り
プラグインのセキュリティ

This property determines the level of detail that the solid modeled part will be shown in. It can be set to the possible values of the Enum.RenderFidelity enum.

By default, solid modeled parts will always be shown in precise fidelity, no matter how far they are from the camera. This improves their appearance when viewed from any distance, but if a place has a large number of detailed solid modeled parts, it may reduce overall performance.

Distance From CameraRender Fidelity
Less than 250 studsHighest
250-500 studsMedium
500 or more studsLowest

SmoothingAngle

並列読み取り
プラグインのセキュリティ

This property represents an angle in degrees for a threshold value between face normals on a solid modeled part. If the normal difference is less than the value, normals will be adjusted to smooth the difference. While a value between 30 and 70 degrees usually produces a good result, values between 90 and 180 are not recommended as they may cause a "shadowing" effect on unions with sharp edges.

Note that smoothing does not affect the normals between different materials or different colors.

Solid modeled part with SmoothingAngle of 0
SmoothingAngle = 0
Solid modeled part with SmoothingAngle of 50
SmoothingAngle = 50

TriangleCount

読み取り専用
複製されていません
並列読み取り

The number of polygons in this solid model.

UsePartColor

並列読み取り

Sets whether the PartOperation can be recolored using the BasePart.Color or BasePart.BrickColor properties. When true, the entire union will be colored as per Color or BrickColor. When false, the parts in the union will maintain their original colors from before the onion operation was performed.

方法

SubstituteGeometry

void

Substitutes the geometry of this PartOperation with the geometry of another PartOperation. This makes it easier to utilize the geometry of a solid modeling operation like UnionAsync(), SubtractAsync(), or IntersectAsync() but maintain properties, attributes, tags, and children of the main part such as Attachments, Constraints, ParticleEmitters, light objects, decals, and more. This approach also circumvents the potential "flicker" of completely replacing the original PartOperation with another.

Note that if you're calling this method on a PartOperation with child Attachments or Constraints, you should calculate the affected instances with CalculateConstraintsToPreserve(), then drop those whose recommended parent is nil.

パラメータ

source: Instance

The PartOperation whose geometry will substitute the geometry of this PartOperation.


戻り値

void

コードサンプル

Substitute Geometry and Drop Constraints

local GeometryService = game:GetService("GeometryService")
local mainPart = workspace.PurpleBlock
local otherParts = {workspace.BlueBlock}
local options = {
CollisionFidelity = Enum.CollisionFidelity.Default,
RenderFidelity = Enum.RenderFidelity.Automatic,
SplitApart = false
}
local constraintOptions = {
tolerance = 0.1,
weldConstraintPreserve = Enum.WeldConstraintPreserve.All
}
-- Perform union operation in pcall() since it's asyncronous
local success, newParts = pcall(function()
return GeometryService:UnionAsync(mainPart, otherParts, options)
end)
if success and #newParts > 0 and mainPart:IsA("PartOperation") then
-- Set first part in resulting operation as part to use for substitution
-- First part is simply an option; this can be any PartOperation
local substitutePart = newParts[1]
-- Reposition part to the position of main part
substitutePart.CFrame = mainPart.CFrame
-- Calculate constraints/attachments to either preserve or drop
local recommendedTable = GeometryService:CalculateConstraintsToPreserve(mainPart, newParts, constraintOptions)
-- Substitute main part's geometry with substitution geometry
mainPart:SubstituteGeometry(substitutePart)
-- Drop constraints/attachments that are not automatically preserved with substitution
for _, item in pairs(recommendedTable) do
if item.Attachment then
if item.ConstraintParent == nil then
item.Constraint.Parent = nil
end
if item.AttachmentParent == nil then
item.Attachment.Parent = nil
end
elseif item.WeldConstraint then
if item.Parent == nil then
item.WeldConstraint.Parent = nil
end
end
end
-- Destroy other parts
for _, otherPart in pairs(otherParts) do
otherPart.Parent = nil
otherPart:Destroy()
end
end

イベント