Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    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. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    191
    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:
    191
    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.