Any chance of Codea supporting 3d Touch ?
Yes, i wonder that to, and will it be a updatete for Ios 9 ready when it reales next week?
I don’t see how this can be generalized to something like
a = getTouchPoint(touched)
because a touch on the screen just indicates a direction, ie depth is undefined. If you want to stop at the first object you hit in that direction, then Codea would have to be given a table of objects to examine.
There are three different ways I can think of, to identify which object was touched.
One is to use math, if it’s a simple regular object like a plane or sphere. LoopSpace has written code for planes, but I don’t think there is currently any code for any 3D objects.
Another is to redraw the screen to an image in memory, replacing colours with codes for each object. This steals a frame, but handles any object and any orientation or occlusion (and can even “see through” transparent pixels of objects in front), and - if you want to encode different parts of an object separately - can tell you which part of an object was touched, or even (for single texture objects) can tell you which point on the texture was touched.
A third is to measure the distance to each touchable object, calculate the point at that distance along the line of touch, and (for quasi circular objects anyway) measure how far it is from there to the centre of the object to see if it is close enough to qualify as a hit. This is nice for just selecting or shooting at things.
So it depends what you want, and I can’t see that one size fits all, or that it is easy for Codea to know what things you are trying to touch.
I’ve written quite a number of posts on this subject, if you’re interested, because I use 3D touch a lot in my projects.
@Ignatz From my reading, what Apple is calling “3D Touch” is not what we’ve been discussing as “3D Touch”. It’s touch with a bit more information, specifically how hard you’re pressing. I wonder if we could simulate this already with the touch radius.
Ah, thank you, I misunderstood.
I think variable finger pressure has been tried recently in the forum, but the results depended on the individual and weren’t reliable.