- Home /
Android Joystick
Hey everyone. Im trying to make a first person controller for unity. I cant get the prefabs in the standard assets (mobile) to work. I have tried to add the single joystick to my player, but it won't appear. Anyone have any ideas? Thanks
Hi $$anonymous$$ona,
What version of unity are you using?
Are you after single analogue movement?
Im using unity 3.5 and Im just looking for some joystick and joystick script that i can use to move a player
Answer by LordZephyr · Dec 06, 2012 at 04:59 PM
Hi,
The best thing that I have done was to use the prefab first person joysticks that came with the Standard Assets (Mobile). You must load the mobile standard assets to be able to load in the prefabs of the joysticks that are available for the Android and the iOS operating systems. One joystick controls the view of the player and the other controls the movement of the player. If you wish to remove one of the joysticks, it is really easy to do that. If you want to change what the joystick does, that is easy as well. You simply have to replace the script for the joystick that you want to change.
Now, to get to what I think your problem is: From your description, it sounds like you can't get your joysticks to work because you can't see them. Here's the trick that I figured out the hard way. First, delete the first person prefab that you already put into your scene. DO NOT drag a new one from your (mobile) assets to the screen. You MUST drag a new First Person Controls to the Hierarchy and not to the Scene window. If you drag it to the Scene window, the parts will be in the wrong location. Once it is there, DO NOT MOVE IT!!! If you move the entire prefab, the joysticks on the screen will move as well and then you won't be able to control your character. Open the parent prefab of the First Person Controls in the Hierarchy and then select the First Person Controls child. That you may move without moving the joysticks. You will see the left and right joysticks as the children, also. They MUST stay where they land when you first place your first person prefab. If you want to move the first person to a starting position for your level you must move only the child First Person Controls. Keep your eyes on the joysticks in the game view. If they start to move, undo your move and re-choose your capsule so that your joysticks don't move. Once you get the capsule to the position you want, save the scene and the game and you should have no problem playing. Test it out.
I hope this helps.
Tom
Thank you so much! This was the one setback that was stopping me in advancing in my project! It works fine now.
i am implementing the same and succeed in doing that but my movement and camera rotation is not smooth. can you please suggest any way?
I am so sorry it took me so long to get back to you, @rohit_garg.
From what I can tell by your description, you might have too many prims (objects with too many sides) in your scene. Try to take your first person controller exactly as it is and put it into a scene that just has a plain so you can move around and see if there is any jerkiness to your movements.
Let me know if this works. If not, we could try something else and I promise not to take as long getting back to you.
$$anonymous$$
@lordZephyr thanks for your reply. I found my error. Actually the fbx file i imported in unity was carrying the whole history from the starting. Thats why scene was giving jerkness.
Hey, but i have problem i don't have this standar assest?
Answer by idiot333 · Apr 18, 2015 at 01:58 PM
There's another so;ution for implementing controls.
[https://www.youtube.com/watch?v=CqvK_YiKAkY][1]
this is a link to tutorial for touch input manager which is on asset store and making controls is very easy in that.