3D Touch / Force Touch

Hello all,

I have a question regarding the new iPhone 6S and 6S Plus.

Will Corona provide an API for handling 3D touch (pressure-based)?

Regards,

Radu

Hi Radu,

We don’t have specific plans on this feature yet, as it’s very OS-specific and device-specific. However, if you wish, please file a feedback/feature request so others may vote on it:

https://feedback.coronalabs.com

Thanks,

Brent

Hi Brent,

Sure, I’ll submit a feature request via the form.

Thanks,

Radu

Hi Radu,

Thanks for filing the request. For others who wish to vote on this, here is the link:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/9876846-3d-touch-for-ios

Brent

If you’re interested, Corona already supports pressure touch on Android.  We’ve supported it on Android for the past 2 years via our InputDevice feature, which is the same feature you use to access game controller, mice, keyboards, etc.

You can detect if a touchscreen exists on Android by calling the system.getInputDevices() function and looking for an InputDevice of type “touchscreen”.  Note that you won’t find a touchscreen InputDevice on an Android TV like device.

   https://docs.coronalabs.com/api/library/system/getInputDevices.html

   https://docs.coronalabs.com/api/type/InputDevice/type.html

An InputDevice typically has an array of axes which you can retrieve via the InputDevice:getAxes() function.  An InputAxis provides analog data, such as a joystick’s x and y axis data.  A “touchscreen” InputDevice will always provide axes of type “x” and “y” to represent the primary touch coordinate onscreen, but you’ll need to sweep through the axes to see if the touchscreen supports an axis of type “pressure”.  If it does, then you’ll know that pressure data will be provided by the device.

   https://docs.coronalabs.com/api/type/InputDevice/getAxes.html

   https://docs.coronalabs.com/api/type/InputAxis/type.html

From there, you can add a Runtime:addEventListern(“axis”, …) to listen for axis data.  You’ll want to set up your listener function to listen for axis data of type “pressure” from an InputDevice of type “touchscreen” like this…

local function onAxisEvent(event) if (event.device) then if (event.device.type == "touchscreen") and (event.axis.type == "pressure") then -- This value should range from 0 to 1.0 local normalizedPressureValue = event.normalizedValue end end end Runtime:addEventListener("axis", onAxisEvent)

So, anyways, that’s how you would implement it on Android.  We probably wouldn’t handle quite the same way on iOS since on Android we’re providing the raw data from all available input devices, but it’s something for you to play around with if you wish.

Josh, that’s some pretty nice stuff.

Thanks!

Radu

Oh great - this would be the way to implement this on IOS as well.

Voting for this feature.

@Joshua Quick I have a client that needs this feature so his app with over 1M downloads could be featured for using new feature. Let me know what is your timeline for this.

@Blerdo.com,

Add your vote for 3d touch support to the user feedback page here…

   http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/9876846-3d-touch-for-ios

Right now, the number of votes are really low compared to the demand for iOS TV support.  And to be fair to the rest of the Corona community, we need to focus our time/resources on feature requests that have the most demand.  But we’re willing to be convinced.  The more votes the better.

Hi Radu,

We don’t have specific plans on this feature yet, as it’s very OS-specific and device-specific. However, if you wish, please file a feedback/feature request so others may vote on it:

https://feedback.coronalabs.com

Thanks,

Brent

Hi Brent,

Sure, I’ll submit a feature request via the form.

Thanks,

Radu

Hi Radu,

Thanks for filing the request. For others who wish to vote on this, here is the link:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/9876846-3d-touch-for-ios

Brent

If you’re interested, Corona already supports pressure touch on Android.  We’ve supported it on Android for the past 2 years via our InputDevice feature, which is the same feature you use to access game controller, mice, keyboards, etc.

You can detect if a touchscreen exists on Android by calling the system.getInputDevices() function and looking for an InputDevice of type “touchscreen”.  Note that you won’t find a touchscreen InputDevice on an Android TV like device.

   https://docs.coronalabs.com/api/library/system/getInputDevices.html

   https://docs.coronalabs.com/api/type/InputDevice/type.html

An InputDevice typically has an array of axes which you can retrieve via the InputDevice:getAxes() function.  An InputAxis provides analog data, such as a joystick’s x and y axis data.  A “touchscreen” InputDevice will always provide axes of type “x” and “y” to represent the primary touch coordinate onscreen, but you’ll need to sweep through the axes to see if the touchscreen supports an axis of type “pressure”.  If it does, then you’ll know that pressure data will be provided by the device.

   https://docs.coronalabs.com/api/type/InputDevice/getAxes.html

   https://docs.coronalabs.com/api/type/InputAxis/type.html

From there, you can add a Runtime:addEventListern(“axis”, …) to listen for axis data.  You’ll want to set up your listener function to listen for axis data of type “pressure” from an InputDevice of type “touchscreen” like this…

local function onAxisEvent(event) if (event.device) then if (event.device.type == "touchscreen") and (event.axis.type == "pressure") then -- This value should range from 0 to 1.0 local normalizedPressureValue = event.normalizedValue end end end Runtime:addEventListener("axis", onAxisEvent)

So, anyways, that’s how you would implement it on Android.  We probably wouldn’t handle quite the same way on iOS since on Android we’re providing the raw data from all available input devices, but it’s something for you to play around with if you wish.

Josh, that’s some pretty nice stuff.

Thanks!

Radu

Oh great - this would be the way to implement this on IOS as well.

Voting for this feature.

@Joshua Quick I have a client that needs this feature so his app with over 1M downloads could be featured for using new feature. Let me know what is your timeline for this.

@Blerdo.com,

Add your vote for 3d touch support to the user feedback page here…

   http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/9876846-3d-touch-for-ios

Right now, the number of votes are really low compared to the demand for iOS TV support.  And to be fair to the rest of the Corona community, we need to focus our time/resources on feature requests that have the most demand.  But we’re willing to be convinced.  The more votes the better.