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 Edyvargas · Sep 02, 2014 at 02:03 AM · axissphereplanet

Rotation Script Changes the Object Axis Inclination Too

Hi Everyone,

I have a rotation script for the rotation of a planet (The Earth) but the planet has a 23,67 inclination degrees on its own axis (on the Y rotation vector of the Sphere Object), and the rotation script works fine at any speed until i give the planet object its proper inclination degrees, then , when i change the speed of the rotation, the sphere wont mantain its correct axis and change its inclination, this is the script:

 var rotationSpeed: float = 15;
 
 function Update() {        
 
 // planet to spin on it's own axis 
 transform.Rotate(transform.up * rotationSpeed * Time.deltaTime, Space.World);
 
 }

Thanks to any Help :)!

Comment
Add comment · Show 3
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 SaxonHammer · Sep 02, 2014 at 02:09 AM 0
Share

You have used Space.World in the rotation so that transform.up now means world space up ie the Y axis

avatar image Edyvargas · Sep 02, 2014 at 02:13 AM 0
Share

Hi, thanks for the fast answer!, but when i put "Space.Self" ins$$anonymous$$d, it gets crazy and rotates everywhere....

avatar image Edyvargas · Sep 02, 2014 at 03:07 AM 0
Share

...Interesting, when i use transform.right ins$$anonymous$$d of transform.up in the script, the object rotates well on its own center at any speed, dont know why....

2 Replies

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

Answer by Edyvargas · Sep 02, 2014 at 04:33 AM

SOLVED!, in the first code i changed transform.up for Vector3.up, and its working great now, thanks and hope this helps to anybody with a similar issue, the working code its this:

var rotationSpeed: float = 15;

function Update() {

transform.Rotate(Vector3.up rotationSpeed Time.deltaTime, Space.World);

}

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
avatar image
0

Answer by Edyvargas · Sep 02, 2014 at 02:58 AM

I found that using the RotateBehaviour.cs script from the Standard Assets, the sphere object rotates fine on its own pivot center even after of being tilted some degrees, but i need to use it in the javascript code, any idea? thank you:

 using UnityEngine;
 using System.Collections;
 
 //Decompile by Si Borokokok
 
 public class RotateBehaviour : MonoBehaviour
 {
     public Vector3 RotationAmount;
 
     private void Update()
     {
         transform.Rotate((Vector3) (RotationAmount * Time.deltaTime));
     }
 }
 
 
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

23 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

Related Questions

how to control the horizontal position of object in a 4 units wide plane? 0 Answers

Generating randomness in a sphere. Only working horizontally. (Image in description) 0 Answers

Can a ball rotate without moving and changing its axis? 1 Answer

how to make gravity in the center of a sphere 1 Answer

areas(continents) on my spherical planet 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