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 shaun lamminga · Oct 26, 2010 at 08:43 AM · rotationtransformrotaterotatearound

rotation script in unity

Ive just started using unity and have been trying to make a 2.5d sidescroller,i need help to make a platform rotate 90 degrees verticaly and then back....i would realy like to know how to do this...please help :)

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Ostagar · Oct 26, 2010 at 09:21 AM

Transform.Rotate() will rotate the platform around its midpoint. If you want to rotate around another point such as the edge, you'll need Transform.RotateAround() instead. With a little fiddling you should be able to figure out the vectors that work best for you, eg Vector3.forward or Vector3.left.

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 shaun lamminga · Oct 26, 2010 at 11:53 AM 0
Share

Thanx ive been trying it .... how would you write up a script for the platform... i think im doing somthing wrong

avatar image shaun lamminga · Oct 28, 2010 at 12:25 PM 0
Share

Hey thanx im really getting somewhere with the link you gave me ... all i need is you to edit my code so that it stops at 90 degrees for three seconds and then turns back.... sorry im not very experienced at all and you obviosly know what your doing... your help would be greatly appretiated

i will post my code up as an answere

avatar image
1

Answer by shaun lamminga · Oct 28, 2010 at 12:29 PM

var right = true;

function Update () {

if (right) { rotation = 100.0; transform.Rotate (0,0,rotation * Time.deltaTime); }

}

Comment
Add comment · Show 1 · 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 shaun lamminga · Oct 28, 2010 at 12:29 PM 0
Share

this is how i got it to rotate continuously.

avatar image
0

Answer by shaun lamminga · Oct 26, 2010 at 11:24 AM

Thanx ive been trying it .... how would you write up a script for the platform... i think im doing somthing wrong

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 Ostagar · Oct 26, 2010 at 04:06 PM 0
Share

I have working code using these function, but there's working code and an explanation of the parameters in the Unity documentation pages already. In case you didn't spot those yet, they're at http://unity3d.com/support/documentation/ScriptReference/index.html. If that doesn't make things clearer, if you could post an example of what you tried and why that wasn't working for you, we could help you better. Cheers. :)

avatar image shaun lamminga · Oct 27, 2010 at 07:55 AM 0
Share

thanx for the comment and the link although im kinda geting to know vectors i still have no idea of how to do this or use the transform script ... an example would help alot

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

No one has followed this question yet.

Related Questions

transform.rotate only 1 time for 180 degrees? 1 Answer

An alternative to RotateAround for collisions 0 Answers

Rotation Angle not precise 1 Answer

Unity 3d(Space) Questions 1 Answer

Rotate around moves object out of position, why? 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