Touch position off from real position?

Hello, I’ve been working on a new project… never had this issue before though. I’m using EasyTouch, but I’ve run into this with other things. As it is the same Asset I used in my last game with no problems.

I made a variable for the sake of recording it’s touch position. I have a character, and I want to be able to have it change directions, if you touch on the left side or the ride side of him. Except my character is at around -25 units on the X axis. When I touch around him, it’s such a huge different. Around position 600 units on the X axis.

Does anyone know what might be causing such a large offset?

It’s not in the code, because I only have a few lines… only asking if gesture.position.x < the game objects position. or greater.

Edit: Here is the code I used (attached to the camera), I have also noticed… the character twitches and can’t move past a certain point (it auto-flips him back around).

var mainCharacter : exSpriteAnimation;
var mainCharacterBase : exSprite;
var mainCharacterObject : GameObject;
var touchx : float;
var touchy : float;

function Start()
{
	mainCharacter.Play("idle");

}

function On_TouchStart(gesture:Gesture)
{
	// Play "walk right" animation if touch at ground level
	if(gesture.position.x > mainCharacterObject.transform.position.x){
			
			mainCharacter.Play("walk");
			mainCharacterObject.transform.position.y = mainCharacterObject.transform.position.y - 8;
			mainCharacterObject.transform.eulerAngles.y = 0;
			
	}
	
	// Play "walk right" animation if touch at ground level
	if(gesture.position.x < mainCharacterObject.transform.position.x){

			mainCharacter.Play("walk");
			mainCharacterObject.transform.position.y = mainCharacterObject.transform.position.y - 8;
			mainCharacterObject.transform.eulerAngles.y = 180;
			
	}
	
}


function On_TouchDown(gesture:Gesture)
{
	// Translate "walk right" animation if touch at ground level
	if(gesture.position.x > mainCharacterObject.transform.position.x){
			mainCharacterObject.transform.Translate(2,0,0);
			mainCharacterObject.transform.eulerAngles.y = 0;
			
	}
	
	// Translate "walk right" animation if touch at ground level
	if(gesture.position.x < mainCharacterObject.transform.position.x){
			mainCharacterObject.transform.Translate(2,0,0);
			mainCharacterObject.transform.eulerAngles.y = 180;
			
	}
	
}


function On_TouchUp(gesture:Gesture)
{
	mainCharacter.Play("idle");
	mainCharacterObject.transform.position.y = mainCharacterObject.transform.position.y + 8;

}

I never used EasyTouch, but it seems the touch position is, like almost always, in screen coordinates. As in the first code example on this page you can see he uses cam.ScreenToWorldPoint. Keep in mind that would only work with an orthographic camera. With a perspective camera you need to use a raycast to project the 2d point into world space.

A common way to project a screen point to world space for a 2d or 2.5d game is to use a Plane

See the edit in my answer on this question.