Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Copy rotation from child and rotate it from there

Discussion in 'Scripting' started by alexxjaz, May 1, 2020.

  1. alexxjaz

    alexxjaz

    Joined:
    Sep 18, 2018
    Posts:
    45
    Hello! So, I want to make my weapon aim to x point, but since the pivor point isnt in the tip I need to tweak it.

    Now I have a empty in the tip of the weapon with a lookat to the point that I want to aim, but now I need to rotate the weapon from that point and copy the childs rotation. What can I do? Thank you
     
  2. sbalanoff

    sbalanoff

    Joined:
    Nov 14, 2019
    Posts:
    36
    I would create a parent object (empty) of which the pivot point (center) is correct and add the script to that.

    EDIT: or alternatively if you are using 2D you could go to the sprite and editor and change the pivot point (blue dot)
     
  3. alexxjaz

    alexxjaz

    Joined:
    Sep 18, 2018
    Posts:
    45
    Yeah but for example think that you have a guy holding a stick with one hand and the other tip is on the ground. How do you choose if you rotate it from the hand or from the ground?
     
  4. sbalanoff

    sbalanoff

    Joined:
    Nov 14, 2019
    Posts:
    36
    Are you using 2D or 3D?
     
  5. alexxjaz

    alexxjaz

    Joined:
    Sep 18, 2018
    Posts:
    45
    3D
     
  6. sbalanoff

    sbalanoff

    Joined:
    Nov 14, 2019
    Posts:
    36