Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Thet Naing Swe · Oct 25, 2010 at 04:53 PM · objectrotateangledegrees

rotate the object only 360degree for once

How can I rotate my Object 360 degree once from code.

euler.z = 360.0f;

 Quaternion rot = Quaternion.Euler(euler);
 transform.rotation = Quaternion.Lerp(transform.rotation, rot, 0.1f);

and it doesn't work...

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

2 Replies

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

Answer by lhk · Oct 25, 2010 at 06:25 PM

I'm sorry but I don't understand your question. If you rotate something 360 degrees, you could simply not rotate it instead. 360 degrees are one complete turn. If you want to rotate it gradually around 360 degrees you should specify the code you posted. What kind of variable is euler ? Where did you insert this code ? Assuming, that you've written this in the Update function, you could try this c# code instead

float rotationleft=360;
float rotationspeed=10;
void Update()

{

float rotation=rotationspeed*Time.deltaTime;
{
    rotationleft-=rotation;
}
else
{
    rotation=rotationleft;
    rotationleft=0;
}
transform.Rotate(0,0,rotation);

}

Comment
Add comment · Show 4 · 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 Thet Naing Swe · Oct 26, 2010 at 07:09 AM 0
Share

Thanks.. I will try with ur logic...

avatar image Thet Naing Swe · Oct 26, 2010 at 03:58 PM 0
Share

Thanks dude.. It's kinda works thay way

avatar image captainbacon · Jun 13, 2013 at 07:21 AM 0
Share

Thanks for the code it really helped me and saved me time !

avatar image Sparkline · Mar 07, 2014 at 03:13 PM 0
Share

where is IF in that code?

avatar image
5

Answer by Perfecter · Feb 08, 2015 at 08:19 PM

 float rotationleft=360;
 float rotationspeed=10;
 void Update()
 {
 
 float rotation=rotationspeed*Time.deltaTime;
 if (rotationLeft > rotation)
 {
     rotationleft-=rotation;
 }
 else
 {
     rotation=rotationleft;
     rotationleft=0;
 }
 transform.Rotate(0,0,rotation);
 }
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 Sajalsh25 · Aug 21, 2016 at 09:53 PM 0
Share

THAN$$anonymous$$S A TON

avatar image ClearRoseOfWar · Oct 25, 2017 at 03:47 AM 0
Share

this should be best answer.. just saying.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Rotate player 360 degrees once 0 Answers

How can I rotate an object with certain degrees? 2 Answers

Rotate object in a set amount of time 1 Answer

Transform.Rotate() stuck at 90 and 270 degrees 3 Answers

How to find the angle an object is rotated? 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