HapticEffect

사용되지 않는 항목 표시

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

찾아볼 수 없음

현대 컨트롤러와 장치에는 촉각 피드백을 제공하기 위해 모터가 내장되어 있습니다.진동과 소음을 추가하면 시각적 또는 오디오전달하기 어려운 미묘한 피드백을 제공할 수 있습니다.

Roblox는 다음 장치에 대해 햅틱을 지원합니다:

  • 대부분의 iPhone, Pixel 및 Samsung Galaxy 장치를 포함하는 하aptics를 지원하는 Android 및 iOS 전화
  • 플레이스테이션 게임패드
  • Xbox 게임패드
  • 퀘스트 터치 컨트롤러

요약

속성

메서드

  • Play():()

    촉각 효과를 재생합니다.

  • 사용자 지정 웨이브포밼을 테이블로 정의하고 해피티크에 적용하는 데 사용되는 메서드.

  • Stop():()

    촉각 효과를 중지합니다.

속성

Looped

병렬 읽기

촉각 효과 루프가 연속으로 실행되는지 여부.


local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Looped = true
effect.Parent = Workspace
-- Start the haptic effect
effect:Play()
-- After two seconds, stop the effect
task.wait(2)
effect:Stop()

Position

병렬 읽기

Radius 와 함께, 입력 장치에 대한 영향 위치와 효과적으로 근처 모터의 영향 범위를 지정합니다.일부 게임패드에는 "작은"과 "큰" 모터가 모두 없고 "게임패드 대형 왼쪽/오른쪽"이 PC에서 지원되지 않는다는 점에 유의하십시오.


local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
-- Set the position and radius of impact
effect.Position = Vector3.new(0.5, 0.5, 0)
effect.Radius = 1
effect.Parent = Workspace
effect:Play()

Radius

병렬 읽기

함께 Position , 입력 장치와 관련된 영향 반경과 효과적으로 근처 모터의 영향 범위를 지정합니다.일부 게임패드에는 "작은"과 "큰" 모터가 모두 없고 "게임패드 대형 왼쪽/오른쪽"이 PC에서 지원되지 않는다는 점에 유의하십시오.


local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
-- Set the position and radius of impact
effect.Position = Vector3.new(0.5, 0.5, 0)
effect.Radius = 1
effect.Parent = Workspace
-- Play the haptic effect
effect:Play()
병렬 읽기

큰 즉각적인 충격이 빠르게 사멸하는 경우와 같이 햅틱 유형, Enum.HapticEffectType.GameplayCollision 큰 즉각적인 충격이 빠르게 사멸하는 경우와 같이 햅틱 유형,Enum.HapticEffectType.Custom은 사용자 정의 웨이브폼 키를 통해 정의된 하aptic을 지정할 수 있게 해줍니다 SetWaveformKeys()를 통해 정의된 하aptic을 지정할 수 있게 해줍니다

Waveform

Roblox 스크립트 보안
병렬 읽기

메서드

Play

()

촉각 효과를 재생합니다.


local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Parent = Workspace
-- Play the haptic effect
effect:Play()

반환

()

SetWaveformKeys

()

이 메서드를 사용하면 테이블로 사용자 지정 웨이브포밍을 정의하고 해피티크에 적용할 수 있습니다.


local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
-- Set effect type to custom in order to define a waveform
effect.Type = Enum.HapticEffectType.Custom
effect.Parent = Workspace
-- Define the custom waveform curve through a table
local rampUpWaveform = {
FloatCurveKey.new(0, 0.3),
FloatCurveKey.new(100, 0.4),
FloatCurveKey.new(300, 0.8),
FloatCurveKey.new(400, 1.0)
}
-- Set waveform through the effect's method
effect:SetWaveformKeys(rampUpWaveform)

매개 변수

keys: Array
기본값: ""

반환

()

Stop

()

촉각 효과를 중지합니다.


local Workspace = game:GetService("Workspace")
local effect = Instance.new("HapticEffect")
effect.Type = Enum.HapticEffectType.GameplayExplosion
effect.Looped = true
effect.Parent = Workspace
-- Start the haptic effect
effect:Play()
-- After two seconds, stop the effect
task.wait(2)
effect:Stop()

반환

()

이벤트