Right now I am taking the iPhoneInput.GetTouch(0).position and I am trying to see if that position falls within the bounding box of an object. The object is a plane that moves across the x-axis.
I have created a Bounds variable that I believe is in local space and so I use Transform.TransformPoint(Bounds.size) to get world space Vector3 and then saving that to variable.
CenterPosition = Bounds(Vector3(1173.536, 848.1216, -214.2831), Vector3(200, 200, 0));
localToWorldCenterPosition = planeTransform.TransformPoint(CenterPosition.size);
Then I get the iPhoneInput.GetTouch(0).position and then save that to a Vector3 after I added a z value of 0 to the iPhoneInput.GetTouch(0).position.
var newPoint : Vector3 = Vector3(iPhoneInput.GetTouch(0).position.x, iPhoneInput.GetTouch(0).position.y, 0);
I then check to see if there is a single touch and if the touch moved. That is when I check to see if the touch position was within the plane's bounds.
if(iPhoneInput.touchCount == 1 && iPhoneInput.GetTouch(0).phase == iPhoneTouchPhase.Moved && singlePlane.CenterPosition.Contains(singlePlane.newPoint))
When I run the code the plane moves back and forth on the x-plane and when I try to touch the plane nothing happens. I know that I'm doing something silly, but I can't figure out what it is? Any help would be appreciated.