Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by edredar · Jul 27, 2012 at 10:59 PM · iosaddforcecontrols

iOS controls

How can I make my ball moving on the touch screen? I want to make a round joystick. I've used the following script:

     function Update () {
 if (Input.GetKey ("up")) {
 rigidbody.AddForce (0, 0, 7);
 }
 if (Input.GetKey ("down")) {
 rigidbody.AddForce (0, 0, -7);
 }
 if (Input.GetKey ("left")) {
 rigidbody.AddForce (-7, 0, 0);
 }
 if (Input.GetKey ("right")) {
 rigidbody.AddForce (7, 0, 0);
 
 }
 }

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image reptilebeats · Jul 27, 2012 at 11:11 PM 0
Share

i would look at the iOS example that unity has, penelope. it has a round joystick.

avatar image edredar · Jul 27, 2012 at 11:24 PM 0
Share

I don't understand c#))

avatar image AlucardJay · Jul 27, 2012 at 11:35 PM 0
Share

from memory, the Penelope Tutorial is in unity's JavaScript =]

avatar image reptilebeats · Jul 27, 2012 at 11:37 PM 0
Share

i think their is a tool that can convert it to java, I'm not a 100% percent on that though. joysticks though i haven't done yet as i don't need one so i can't really help.

avatar image AlucardJay · Jul 27, 2012 at 11:42 PM 0
Share

I just checked and confirmed that the Penelope Tutorial is in js, but you'll need Unity Remote to test it (which means a paid apple developer licence and provisioning). You may be able to go all the way through and run in a simulator (free apple dev licence), you'll just have to try it out and see.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by AlucardJay · Jul 27, 2012 at 11:33 PM

You need to look into the Input states for iOS, using touch is a bit different to mouse and keyboard :

http://docs.unity3d.com/Documentation/ScriptReference/Input-touches.html

http://docs.unity3d.com/Documentation/ScriptReference/Touch.html

http://docs.unity3d.com/Documentation/ScriptReference/TouchPhase.html

Also look at reptilebeats Penelope link =]

Here is an example of reading different Touch States (scroll down to my answer) : http://forum.unity3d.com/threads/142758-Moving-objects-with-your-finger

An example on rotating with Touch Input : http://answers.unity3d.com/questions/289055/rotate-on-drag-for-ios.html

And when the silly spammers leave UnifyCommunity alone, and it gets fixed, check this script. It's what taught me about Touch Input : http://unifycommunity.com/wiki/index.php?title=Tap_to_Move_Drag_to_Look_iPhone

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Player movement relative to the camera 4 Answers

Mobile controls need help writing script for 2d game? 0 Answers

Accelometer controls for iOS and android 2 Answers

Question about IOS controls 0 Answers

Simultaneous Touch Drag Controls 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges