Decal

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

데칼 개체는 이미지를 BasePart의 얼굴에 적용하는 개체입니다.

데칼은 어떻게 작동하나요?

데칼은 부모인 BasePart에 이미지를 적용합니다.이 이미지가 적용된 표면은 FaceInstance.Face 속성에 따라 달라집니다.데칼의 크기는 얼굴의 크기에 달려 있으므로 데칼의 크기와 비율은 부모의 BasePart.Size를 변경하여 변경될 수 있습니다.

데칼에 적용되는 이미지는 해당 Decal.Texture 속성에 의해 결정됩니다.이미지는 커뮤니티 가이드라인을 준수하는 한 Roblox에 업로드할 수 있습니다.For information on how to upload images, see 텍스처 및 데칼 .

데칼의 대안

데칼에는 다양한 응용 프로그램이 있지만, 일부 경우 개발자는 대신 다음 클래스 중 하나를 선택하길 원할 수 있습니다.

  • 반복되는 타일된 텍스처의 경우 Texture 개체를 사용해야 합니다
  • GUI 요소를 적용하려면 SurfaceGui 개체를 사용해야 합니다
  • 이미지에 대한 조명 효과를 변경해야 하는 경우 SurfaceGui 개체를 사용해야 합니다

코드 샘플

The following code will create a Part on the ground with a Decal applied to its top face. When something hits the part, such as when a player walks over it, the texture applied to the decal will change and a sound will play.

Changing Decal Texture

-- create part
local part = Instance.new("Part")
part.Size = Vector3.new(5, 1, 5)
part.Position = Vector3.new(0, 0.5, 0)
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BrickColor = BrickColor.new("Toothpaste")
-- create decal
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Top
decal.Parent = part
-- create sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxasset://sounds/uuhhh.mp3" -- oof
sound.Parent = part
-- define faces
local happyFace = "http://www.roblox.com/asset/?id=26424652"
local sadFace = "http://www.roblox.com/asset/?id=147144198"
decal.Texture = happyFace
-- touched event
local cooldown = false
part.Touched:Connect(function(hit)
if not cooldown then
if hit and hit.Parent then
cooldown = true
sound:Play()
decal.Texture = sadFace
task.wait(1)
decal.Texture = happyFace
task.wait(0.2)
cooldown = false
end
end
end)
-- add to workspace
part.Parent = workspace

요약

속성

속성FaceInstance에서 상속되었습니다
  • 병렬 읽기

    개체가 표시되는 벽돌의 얼굴을 설정합니다.

속성

Color3

병렬 읽기

The Color3 색조의 the Decal .

개발자는 이 속성이 색상이 아니라 데칼의 색조만 설정한다는 점에 유의해야 합니다.즉, Decal와 연결된 이미지가 원래 흰색(RGB = 1,1,1)이 아니었다면 이 속성을 사용하여 색상을 자유롭게 변경할 수 없습니다.

연합에서 RGB 속성을 Color3 줄이면 개발자가 데칼을 더 어둡게 만들 수 있습니다.

코드 샘플

This code sample creates a Decal in the workspace and changes its Decal.Color3 property on a loop using TweenService.

Decal Color3

local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Size = Vector3.new(10, 10, 1)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Transparency = 1
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Front
decal.Texture = "http://www.roblox.com/asset/?id=1145367640" -- white circle
decal.Parent = part
part.Parent = workspace
local redTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(1, 0, 0) }
)
local greenTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(0, 1, 0) }
)
local blueTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(0, 0, 1) }
)
while true do
redTween:Play()
redTween.Completed:Wait()
greenTween:Play()
greenTween.Completed:Wait()
blueTween:Play()
blueTween.Completed:Wait()
end

LocalTransparencyModifier

숨김
복제되지 않음
병렬 읽기

데칼의 Decal.Transparency 속성에 대한 배수 역할을 합니다. 효과는 Players.LocalPlayer에만 표시됩니다.

이 속성은 Decal.Transparency가 다른 스크립트에 의해 설정되는 상황에서 사용해야 합니다.LocalTransparencyModifier의 이점은 원래 의 변경 없이 변경될 수 있다는 것입니다.

로컬 투명도 수정자가 1로 설정되면 원래 투명도에 관계없이 Decal가 완전히 보이지 않습니다.0으로 설정되면 데칼의 렌더링 투명도가 Decal.Transparency 값과 일치합니다.이것의 수식은:


Displayed Transparency = Transparency + ((1 - Transparency) * LocalTransparencyModifier)

이 속성은 클라이언트에서만 사용되어야 하며 서버에 복제되지 않습니다.

이 속성의 변형에 대해 BaseParts , see BasePart.LocalTransparencyModifier .

Texture

ContentId
병렬 읽기

Decal에 적용될 이미지의 콘텐츠 ID.

데칼을 업로드하려면 어떻게 해야 하나요?

이미지는 커뮤니티 가이드라인을 준수하는 한 Roblox에 업로드할 수 있습니다.이미지 업로드 방법에 대한 자세한 내용은 텍스처 및 데칼을 참조하십시오.

데칼의 콘텐츠 ID를 찾는 방법은 무엇인가요?

SoundAnimation 개체와 달리 데칼의 콘텐츠 ID는 URL의 숫자와 동일하지 않습니다.데칼의 콘텐츠 ID를 찾는 두 가지 주요 방법이 있습니다:

  • Roblox Studio의 텍스처 속성에 URL을 붙여넣습니다.Roblox는 속성을 올바른 콘텐츠 ID로 자동으로 업데이트합니다.이는 Roblox Studio에서만 작동하며 스크립트에서 또는 게임이 실행 중일 때 수행할 수 없습니다.
  • 데칼을 게임에 삽입하세요, 일반적으로 '내 데칼' 아래의 도구 상자를 통해 수행됩니다.내용 ID는 삽입된 데칼에서 찾을 수 있습니다.참고, InsertService:LoadAsset() 개발자가 이 메서드를 자동화하려는 경우에도 사용할 수 있습니다.

코드 샘플

The following code will create a Part on the ground with a Decal applied to its top face. When something hits the part, such as when a player walks over it, the texture applied to the decal will change and a sound will play.

Changing Decal Texture

-- create part
local part = Instance.new("Part")
part.Size = Vector3.new(5, 1, 5)
part.Position = Vector3.new(0, 0.5, 0)
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BrickColor = BrickColor.new("Toothpaste")
-- create decal
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Top
decal.Parent = part
-- create sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxasset://sounds/uuhhh.mp3" -- oof
sound.Parent = part
-- define faces
local happyFace = "http://www.roblox.com/asset/?id=26424652"
local sadFace = "http://www.roblox.com/asset/?id=147144198"
decal.Texture = happyFace
-- touched event
local cooldown = false
part.Touched:Connect(function(hit)
if not cooldown then
if hit and hit.Parent then
cooldown = true
sound:Play()
decal.Texture = sadFace
task.wait(1)
decal.Texture = happyFace
task.wait(0.2)
cooldown = false
end
end
end)
-- add to workspace
part.Parent = workspace

TextureContent

병렬 읽기

Transparency

병렬 읽기

0이 완전히 불투명하고 1이 완전히 투명한 Decal의 투명도를 결정합니다.

참고, DecalsRoblox에 업로드된 원래 이미지 파일의 투명성도 존중합니다.즉, Roblox에 업로드하기 전에 투명도를 변경할 수 있고 투명도 속성을 사용할 필요가 없습니다.

Decal.LocalTransparencyModifier 은 데칼의 투명도 배수로 작용하며, 플레이어 캐릭터와 마찬가지로 데칼의 투명도가 다른 스크립트에 의해 변경될 가능성이 있을 때 사용해야 합니다.

For BaseParts , see BasePart.Transparency .

코드 샘플

The code below will create a transparent Part with a decal that will fade in and out using TweenService and Decal.Transparency.

Fading Decal

local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Size = Vector3.new(10, 10, 1)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Transparency = 1
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Front
decal.Texture = "http://www.roblox.com/asset/?id=699259085" -- roblox logo
decal.Parent = part
part.Parent = workspace
local tween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true),
{ Transparency = 1 }
)
tween:Play()

ZIndex

병렬 읽기

ZIndex는 동일한 의 데칼이 렌더링되는 순서를 결정합니다.데칼은 우선 순위가 상승하는 순서에 렌더링되며, 낮은 값이 먼저 렌더링됩니다.따라서 ZIndex가 더 높은 데칼은 나중에(그리고 낮은 ZIndex의 다른 데칼 위에) 렌더링됩니다.

유효한 값의 범위는 -MAX_INT에서 MAX_INT, 포함(2,147,483,647 또는 (2^31 - 1))입니다.미래에 이미 존재하는 두 개의 데칼 사이에 데칼을 레이어해야 할지 확신할 수 없는 경우, 100의 배수를 사용하는 것이 좋습니다.0, 100, 200.이렇게 하면 다른 요소 사이에 렌더링된 요소에 사용할 수 있는 ZIndex 값의 큰 간격이 보장됩니다.

참조하세요:

메서드

이벤트