UserInputService's TouchPan no Velocity

UserInputService’s TouchPan was returning a velocity of the touch before about a month ago? But now returns 0 all the time. This happens only on mobile devices.

Join on a mobile device and touch anywhere on screen, velocity of touch stays at 0.

Yayyyy.rbxl (14.6 KB)

Since its still included in the API I can imagine this is actually a bug.

9 Likes

Happening again to me. I’ve just tested code from the developer hub and that also returns (0,0) so I’m definitely not doing something wrong. Happens both on the roblox client and in studio.

Was this ever fixed??

Just ran into this myself, was confused as to why the TouchPan velocity was returning Vector2.new(0, 0) even when dragging a finger across the screen.

This signal also doesn’t fire at all in studio via the emulator.

1 Like

Still no velocity when testing on tablet.

This is really not good, TouchPan is used in many different games and velocity is a useful feature. It needs to be fixed.

1 Like

Sorry to bring this topic back up, but I’m having this issue too. I have a custom first person camera system just using Enum.CameraType.Scriptable and I’ve been trying to add mobile support. I tried using the totalTranslation parameter of TouchPan for my camera system, but I noticed a bizarre acceleration effect where the pan is registered as moving faster and faster the longer I keep my finger on the screen. I wanted to use this velocity property in place of the totalTranslation but it’s constantly printing a zero velocity and doesn’t let me move the camera at all.

I’m testing my game from an android device if that means anything. For now I’m going to try playing around with totalTranslation some more to remove the acceleration effect and essentially get the velocity manually, but we’ll see.

Edit: I’ve found somewhat of a workaround by storing the last totalTranslation and subtracting it from the current totalTranslation to get the velocity, and then resetting it back to an empty Vector2 whenever the state is Enum.UserInputState.Begin. It pretty much works fine but issues come whenever I try moving and turning my camera at the same time.

1 Like