Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Problem with Rotation

Discussion in 'Physics' started by unity_PKBBaGHW6XFt3g, Sep 14, 2018.

  1. unity_PKBBaGHW6XFt3g

    unity_PKBBaGHW6XFt3g

    Joined:
    Sep 14, 2018
    Posts:
    4
    Hello. I'm having a problem with the rotation of an object. In the image below, it presents the direction of the axes of the father's object that owns the scripts. When I apply a rotation in this object, it rotates in another axis and not in relation to the origin of this system of axes. i'm sending pics from the axes, the rotate and the script that controls the object. Its like if he make a translation movment about an imaginary point in the center of this rotation.









     

    Attached Files:

  2. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    211
    See the buttons to the right of your tools in your first image? 'Center' and 'Local'?
    The button that says 'Center'/'Pivot' toggles the tool handle position. The tool handle position will ether be in the center of all children under the GameObject selected or at the the pivot origin of the GameObject selected.
    Just change it to 'Pivot' then use the tools to rotate and the GameObject will rotate on itself instead of rotating at the center of all it's children.
     
    Last edited: Sep 17, 2018
  3. unity_PKBBaGHW6XFt3g

    unity_PKBBaGHW6XFt3g

    Joined:
    Sep 14, 2018
    Posts:
    4
    BoogieD thanks, this helped a bit to understand. But when I put it in Pivot mode, this center of rotation appeared. How can I change it?




     

    Attached Files:

  4. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    211
    I'm not sure what you are trying to achieve but I suspect the object with the orange outline is one of the child objects of the parent selected. The child is offset from the parent's center by the amount in the Transform. That's why the parent selected is elsewhere. The child object has also had some of it's axis rotated. That's why it is on a tilt. What are you trying to do?
    Just position the parent first where you want the center of rotation to be and re-position all the child objects where you want them to be in relation to the parent. Then when you move or rotate the parent, all it's children will move and rotate around it.

    Another approach: In the hierarchy, if you were to drag objects on the top level so they became children of another object, the local coordinates in the Transform will be done automatically in relation to the parent. Therefore you can have things placed first before making them children of a parent.
    If you wanted to move the parent but not the children it's easier to drag them off as children in the hierarchy then move the parent and drag them back on as children.The child objects will appear in the same position but have a different parent/child relationship when moving and rotating things.

    Going by your images, the thing above the table must be rotating around something centered above the table. Perhaps that is the parent object named 'default'. It has a parent too.
    You often need to use empty GameObjects as parents to re-position the mesh's center of rotation.
     
    Last edited: Sep 17, 2018
  5. unity_PKBBaGHW6XFt3g

    unity_PKBBaGHW6XFt3g

    Joined:
    Sep 14, 2018
    Posts:
    4
    thanks BoogieD. I solved it with your explain. i just researched about pivot and hierarchy. i created a gameobject where i wanted and make this gameobject a father from the object. one more time, thanks.