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 /
avatar image
1
Question by John 3 · Mar 08, 2010 at 06:50 AM · importrotateaxis

Rotating Objects To Face Proper Direction

After importing a file made in Cinema 3D off the web, I discovered that the objects weren't facing in the correct directions. I tried rotating the objects, but the objects' axis's would also rotate. How do I rotate the objects without affecting their axis's? If an attachable script could do it that would be fantastic!

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
2

Answer by duck · Mar 08, 2010 at 02:55 PM

You can either correct this in your 3D modelling app, or correct this in unity. It's generally preferable to correct it in the 3d modelling ap.

In the case of Cinema 4D, I believe you can adjust the pivot by clicking on the icon with the orange arrows on the toolbar that runs down the left side of the screen.

To correct this in unity, the only simple way is to create another empty GameObject, and add your model as a child of that GameObject. You can then adjust the position and direction of your model so that it faces forwards in relation to the empty parent GameObject's orientation. (In unity, the blue arrow shows the forward Z axis).

You could then create a new prefab to contain this parent-child structure, and you would place any movement or control scripts on the empty parent object.

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 SOIL · May 18, 2010 at 11:23 AM

If it is true, this script should work to fix the rotate problem. I am sorry for the writer of the code, but i found it somewhere in the internet, by using copy & paste to my script database. xD

as a pure grafic artist, i am not able to figure out if it is an c-sharp or java script xD but i think it's c-sharp >.<

here it is, i hope it helps:

public Thing : MonoBehaviour {

Quaternion originalRotation; Vector3 initialFacing;

public void Start() {

 // store original rotation quaternion
 originalRotation = transform.rotation;

 // In what direction does the prefab face?

initialFacing = transform.InverseTransformPoint(Vector3.forward); }

public void Update() {

Vector3 facing = computeNewFacing();

// compute new rotation Quaternion newRotation = originalRotation * Quaternion.FromToRotation(initialFacing, facing);

transform.rotation = newRotation; }

}

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

No one has followed this question yet.

Related Questions

UnityException: Input Axis Rotate is not setup. 2 Answers

Rotate object on the Y axis 90 degrees every 5 minutes? 1 Answer

Rotating Player Controller locally or globally. 0 Answers

Problem with transform.Rotate 1 Answer

X position relative to..... world? 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