I would love to see haptic feedback functionality, this would allow us to give the mobile users extra feedback, for example: I hold down on a button, my phone vibrates a little and gives me some audio feedback, the menu pops up a little bouncy and I can then use the menu. Instead of just holding on the button, a menu opens, boring.
Just like we can do this with controllers, why can’t we with phones?
User feedback is something that I think is really important, if you want a good “user interface” it’s not just about the design itself. But other stuff too. A good interface needs to be appealing to use.
Having haptic feedback would allow developers to create a more streamlined experience across all of iOS, like the homescreen icons when you hold down on them. I’m not sure if other operating systems like Android have an alternative to this.
Was this ever addressed? Currently looking at doing this for an FPS game that just passed 2M visity… Mobile is a little more than half our audience and haptics on mobile should really be looked at for this reason! We at LEAST need Apple device support!
It seems like mobile devices use Gamepad1 for HapticService. Can this be documented somewhere?
Seems like on my iPhone 13 Pro, all 6 VibrationMotors are supported according to IsMotorSupported, but only Large and Small seem to do anything. Are different motors supported by different devices?
The short answer is that the existing API is device-centric (gamepad-centric really). Calls to SetMotor Large/Small will keep working, but we are thinking about modernizing the API and extending it to more devices. Most mobile devices only have a single motor and less haptic features than iPhone 13 Pro, thus I recommend to abstract away from specific hardware to general effect patterns.
I like this addition, but I would have greatly appreciated if:
There was an announcement made before implementing this feature, to let us adapt our game to mobile vibrations. In fact, my games uses vibrations for controller, but the addition of this for mobile caused some inconvenience that I could have anticipated a notice was made before. For example, a user reported that music playing on the phone’s background is lowered while it’s vibrating, which is very annoying.
There was a specific vibration motor enum item for mobile vibrations, or a different input type to trigger vibrations. Currently, as Phoebe said above, the vibration input type is set to Gamepad1, which is very confusing, and caused vibrations, which were intended to be felt on controller, to be on mobile as well, which is not always pertinent or even worse, disturbing.
E.g. instead of “SetMotor Large Left of Gamepad1 to 50%”, you would “SetEffect SmallExplosion Direction”, which then internally gets interpreted for each platform.
Upvote. The documentation of HapticService is poor in other ways too - vibrationvalues is not explained and it’s not clear whether :SetMotor needs to be called again to end the vibration.
You had linked my post so I got notified (I’m not lurking in the thread :p), but I have a working demo here, it’s uncopylocked. Tried just now on my 15 pro max and it works fine:
Yeah, good example.
As everybody said both the API and the documentation aren’t great, since this was written for XBox controllers. Depending on the platform you get a vastly different amount of motors etc. (e.g. most android phones have 1 motor, iOS phones 2, most tablets have 0, Xbox and PS controllers are different and so on).
For some odd reason, @7z99’s game work, however, on my game, after ~1.5 seconds, it would stop vibrating. Anything ran from HapticService would not work. @7z99’s game works just fine, but mine doesn’t. I even went to check every script in the game that uses SetMotor, disabled it, and tested your method of this:
I used a longer wait (because I wanted to see if it would even vibrate at all), but then I realized that it would stop vibrating by itself after 1.5 seconds. Even if you were to run SetMotor again, it would not listen to it at all.
I do not know why my game is the only game affected by this glitch, or how to even fix it. The game used to have its haptics work, but now it doesn’t. Also, when I left the game, I would feel the vibration for a split second before it cutting to Roblox’s home screen.
This is spamming the event every render frame, which at best doesn’t do anything after the first frame and at worst will cause bugs because it doesn’t let the motors react. These haptics motors are not running in “real time”.