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 Ragav R · Feb 17, 2014 at 05:26 AM · rotationrotaterotate objectrotating

Delayed rotation when i use transform.rotate

I am working on rotating an object. My code is working good but for the first time it takes around 10 seconds to start to rotate. I don't know why this is happening.Can anyone know about this ? Thanks in advance for your help. My code is like this ,

if(Input.touches.Length > 0) {

               Touch tchEvent = Input.touches[0];
                 
                 if(tchEvent.phase == TouchPhase.Began)
                 {
                     m_v2LastPoint = tchEvent.position;
                 }            
                 else if(tchEvent.phase == TouchPhase.Ended)
                 {
                     Ray rRay = Camera.main.ScreenPointToRay(Input.touches[0].position);
                     
                     if (Physics.Raycast(rRay.origin, rRay.direction * 10, out m_rhHit)) 
                     {
                         for(int iIndex = 0; iIndex < Global.iNumOfCircles; iIndex++)
                         {
                             if(m_rhHit.transform.name == m_agobjBlock[iIndex].name)
                             {
                                 if(m_gobjSelectedObject != null && m_rhHit.transform.name != m_gobjSelectedObject.name)
                                     m_gobjSelectedObject.renderer.material.mainTexture = m_txtrNormal;
                                 
                                 m_gobjSelectedObject = m_rhHit.transform.gameObject;
                                 m_gobjSelectedObject.renderer.material.mainTexture = m_txtrSelected;
                                 break;
                             }
                         }
                     }
                 }
                 else if(tchEvent.phase == TouchPhase.Moved)
                 {
                     fOffset = tchEvent.position.x - m_v2LastPoint.x;
                     m_gobjSelectedObject.transform.Rotate(0, 0, fOffset * 1f);
                     m_v2LastPoint = tchEvent.position;                        
                 }
             }
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 abi-kr01 · Feb 17, 2014 at 06:07 AM

last time when i was using touch to rotate the game object called string i used Time.delta time i think you should use time.delta time concept it gives float value if it don't work with time see other help available on Time factor , with modified foffset value your code should look something like this

 m_gobjSelectedObject.transform.Rotate(0, 0, fOffset*Time.delta time);

at lest try it work with me may work for you tooo

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 Ragav R · Feb 18, 2014 at 04:23 AM 0
Share

Hi abi.kr01, I have used Time.deltatime but still it gets delayed to rotate for the first time. Can you please tell the reasons why this is happening? I am trying to find a way to this issue for last one week and still...... I want to finish this project as early as possible.

avatar image abi-kr01 · Feb 20, 2014 at 05:06 AM 0
Share

sorry for late reply, apply your raw(own code) code in Fixed Update function because it runs faster hen other updates.so when it start faster and gets executed faster.hope this works fine and u will get result.

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

19 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

Related Questions

How to reset child object's rotation without changing parent's 1 Answer

Strange rotation pattern. 0 Answers

How can I rotate an object without moving it up or down? 0 Answers

managing rotation of Turret on two axis 1 Answer

gameobject stops moving correctly when rotating 1 Answer


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