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 Beennn · Aug 05, 2012 at 10:45 PM · rotationposition

Rotation moving gameObject when position is not 0,0,0

I've spent a couple hours trying to figure out why when the gameObject is rotated it's also moving the position of the gameobject.

When the position of the gameObject is 0,0,0; the object is rotated as you'd expect and only effects the Y axis. However once the object is moved from position 0,0,0, the rotation moves the position as well as the rotation.

The gameObject is NOT parented.

Here's the snippet:

  transform.rotation = Quaternion.Euler(0, ry, 0);
 
  var position = Vector3(x, distance, z);
  var worldPosition = transform.TransformDirection (position);
              
  transform.position = Vector3.Lerp (transform.position, worldPosition, zoomSpeed * Time.deltaTime);
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
0
Best Answer

Answer by DESTRUKTORR · Aug 06, 2012 at 04:23 PM

Your "centerpoint" or "pivot point" is probably not where you think it is. Check each to see where the arrows/rotational-circles show up, and that is the point it will rotate about.

Comment
Add comment · Show 5 · 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 Beennn · Aug 06, 2012 at 05:08 PM 0
Share

There is no pivot point, just it's self. it seems to make position 0,0,0 it's pivot point. Using this method; does it expect a target to pivot around?

avatar image DESTRUKTORR · Aug 06, 2012 at 07:05 PM 0
Share

When you try to rotate it, do the rotationary axes position themselves in the center of the object? or somewhere else? You're probably better off just opening it up in whatever 3D modeling program you used to make it and checking to see where the object's center point is located, there, as it will follow through into Unity.

avatar image Beennn · Aug 06, 2012 at 09:09 PM 0
Share

They are centered; I'm using unity's cubes as place holders, no modelling applications used.

Any other ideas?

avatar image DESTRUKTORR · Aug 08, 2012 at 04:43 PM 1
Share

wait... what is ry? and why are you using euler angles? You may want to use traditional quaternions :P

avatar image Beennn · Aug 11, 2012 at 02:22 AM 0
Share

ry was a float. Wasn't sure about using euler angles, but everything else I tried threw up errors. Sorted now thanks :)

avatar image
0

Answer by Meltdown · Aug 06, 2012 at 07:07 PM

You need to make sure in your modelling tool that your model is saved at 0,0,0 origin and that any transforms are removed. For example Maya has a freeze transforms option.

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 Beennn · Aug 06, 2012 at 08:20 PM 0
Share

No models, just using unity's cubes as place holders.

Any other ideas?

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to always face player relative to player's rotation and how do I use TransformDirection to move a player regardless of Y-rotation? 0 Answers

Freeze camera 1 Answer

transform.forward doesn't work in my code 3 Answers

Objects not always Spawning At Correct Location 2 Answers

how to ignore transform.position.y 3 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