Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by CreativeThinking · Dec 10, 2015 at 12:07 AM · transformmobilerotaterotate objecttouch controls

Making object move up and down in Y axis while rotating down and up

Im trying to figure out how to make my plane object rotate and go up and down in the Y axis with touch on a mobile device. It is a little laggy and it goes backwards in the Z direction too much so when you start to go down it will rotate in a full circle instead of smoothly going down and up in the Y axis. What I want to accomplish is have the plane go down in a smooth direction while rotating down and up slowly, but it is very laggy and slow. Here is my code to show an example of what I'm talking about:

     public float speed = 0.1f;
 public static int forwardSpeed = 20;
 public Vector3 userDirection = Vector3.right;

     if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
             // Get movement of the finger since last frame
             Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
             
             // Move object across XY plane
             transform.Translate(0, touchDeltaPosition.y * speed, 0);
             transform.Rotate(0, 0, touchDeltaPosition.y * speed/0.8f);
         }
img-1699.jpg (146.0 kB)
img-1699.jpg (146.0 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by IsaacHoward · Dec 10, 2015 at 01:45 AM

Im making an rpg and i used this tutorial to move https://youtu.be/XZDjkQ8wEd0?list=PL_4rJ_acBNMH3SExL3yIOzaqj5IP5CJLC&t=891 hope it helps

Comment
Add comment · Show 2 · 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
avatar image CreativeThinking · Dec 10, 2015 at 03:38 AM 0
Share

@IsaacHoward thank you for the video is was pretty helpful, but I'm looking to change the position of the plane using touch. How would I do so using this?

avatar image IsaacHoward CreativeThinking · Dec 10, 2015 at 03:43 AM 0
Share

i do not know iv never used touch controls but if its like pressing a key i would implement it into the

Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal") , Input.GetAxisRaw("Vertical"));

     //if not zero must be moving
     if (movement_vector != Vector2.zero)
     {
         anim.SetBool("isWalking", true);
         anim.SetFloat("input_x", movement_vector.x);
         anim.SetFloat("input_y", movement_vector.y);
     }
     else //sees if in idel or not changes anim
     {
         anim.SetBool("isWalking", false);

     }

you will probably have to do some messing around

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

35 People are following this question.

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

Related Questions

how to rotate a mesh with GetMouseButton with specific rotation value 2 Answers

how do I rotate an object without affecting later rotation? 0 Answers

when trying to rotate, the object transforming itself 0 Answers

Rotating an object with VR controller 1 Answer

Simple Rotate Script won't work! 2 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