- Home /
FPS control mobile changing joystick(guiTexture/touchpad) position when FPS control is not at Origin!
][1]Hello everyone! I am facing this issue since a while and couldn't find any solution. I am using the fps from standard assets mobile, where by default it has 2 joysticks(left touchpad and right touchpad).. When I move the fps control(whole control/main prefab)while developing and not after running the game, in world space, the touchpads dissapear, in fact they change their places, and I run the game and don't see touchpads and ofcourse can't move the player. I tried to figure out how they move and realize that for example if I move the player 1 unit up, the touchpads become at the top of the screen, that means for every unit I move the fps control, the touchpads move at screen.width or screen.height accordingly.
However if I leave the player at (0,0,0) , the controls are in their accurate locations, and everthing going on perfectly. Also I tried moving the player slightly about 0.5 units and then ran the game, the touchpads are in the middle of the screen, but work perfectly.
For now I am obliged to start the scene with the player at 0,0,0 . But I need to start at an another position, and can't find a solution.
I also tried to reset the touchpad position dynamically, like this: rightTouchPadGUITexture.pixelInset.x = (fpsPlayer.transform.position.x)(-Screen.width); rightTouchPadGUITexture.pixelInset.y = (fpsPlayer.transform.position.y)(-Screen.height);
Although I must not have to do this, there must be a simpler solution..
where I get the touchpads by a dragged reference, but still no result.
Please check the pictures for clearer explanation. (Here I have a transparent png for left touchpad, you'll see the change on the right touchpad).
Answer by Loius · Jan 15, 2013 at 08:41 PM
You can't parent the objects to the player - that means they'll move around. You need them to be all on their own (or parented to the "main gui object").
But this is the FPS control that the standard assets support us with. The touchpads are children of the main control. Although your suggestion solves this. thanks
Well, since you're having issues with them moving around, I'd recommmend it. I haven't used that control myself, so I don't know if it always does that or if you've added something (or if you're supposed to add something).
Your answer
Follow this Question
Related Questions
Changing GUITexture's position through code (relative to screen) 1 Answer
Relative GUI positioning and Pixel Inset/Offset conversion 2 Answers
Help|Positing GUITexture on Center (in the middle of he screen) 2 Answers
Inverting text color over a guiTexture-textMesh? - android 0 Answers
Moving a transform behaves odd 0 Answers