Touch Input Vector Position

Hello guys!

I’m having some trouble on setting my touch input. I’m trying to make an object move with a touch swipe, but, I’m not achieving it. As you can see by the print, the problem seems to be in my touch input.

My object appears with X and Y coordinates negative, while my input is with both of them positive. At this time, I was clicking right above the object.

Also, when I swipe up, for exemple, my object moves to the left, like his pivot is rotated. I’ve verified it and it’s not.

It’s meant to be an android game.

Can anyone help me with that? There is also a print of my code where i get my click’s position.


Original mouse position uses screen coordinates, while object position uses world coordinates.

So you should get mouse / touch position, convert it from screen to world - this returns location on near clip plane. Then you must add some offset vector, to move it on desired height. Then apply result location to object.

Some time ago I have experimented with game like this. I used trace result under finger and collision box to get desired location in world, to place aircraft. But maybe you can find other way to convert screen location to desired world location on specific height (Z).

Wow! I’d never guess that.

I solved the problem getting the click position and using the “Convert Screen Location To World Space” node. It’s working really fine.

Thank you! :smiley: