Lernen
Engine-Klasse
HapticService
Veraltet
Nicht erstellbar
Dienst
Nicht repliziert

*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.


Zusammenfassung
Geerbte Mitglieder

API-Referenz
Methoden
GetMotor
Funktionen: Input
HapticService:GetMotor(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor
Parameter
vibrationMotor:Enum.VibrationMotor
Rückgaben

IsMotorSupported
Funktionen: Input
HapticService:IsMotorSupported(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor
Parameter
vibrationMotor:Enum.VibrationMotor
Rückgaben

IsVibrationSupported
Funktionen: Input
HapticService:IsVibrationSupported(inputType:Enum.UserInputType):boolean
Parameter
Rückgaben

SetMotor
Funktionen: Input
HapticService:SetMotor(
inputType:Enum.UserInputType, vibrationMotor:Enum.VibrationMotor, vibrationValues:Tuple
):()
Parameter
vibrationMotor:Enum.VibrationMotor
vibrationValues:Tuple
Rückgaben
()
Code-Beispiele
HapticService:SetMotor()
local UserInputService = game:GetService("UserInputService")
local HapticService = game:GetService("HapticService")
local cachedInputs = {}
local keyToVibration = {
[Enum.KeyCode.ButtonL2] = Enum.VibrationMotor.Small,
[Enum.KeyCode.ButtonR2] = Enum.VibrationMotor.Large,
}
local function onInputChanged(property)
if property == "Position" then
HapticService:SetMotor(inputType, vibrationMotor, input.Position.Z)
end
end
local function onInputBegan(input)
if not cachedInputs[input] then
local inputType = input.UserInputType
if inputType.Name:find("Gamepad") then
local vibrationMotor = keyToVibration[input.KeyCode]
if vibrationMotor then
-- Beobachten Sie diese Eingabe manuell, um den Vibrationsmotor genau zu aktualisieren
cachedInputs[input] = input.Changed:Connect(onInputChanged)
end
end
end
end
UserInputService.InputBegan:Connect(onInputBegan)

©2026 Roblox Corporation. Roblox, das Roblox-Logo und "Powering Imagination" gehören zu unseren eingetragenen und nicht eingetragenen Markenzeichen in den USA und anderen Ländern.