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.

Noob question: calculating offset problem

Discussion in 'Scripting' started by Michael_R, May 16, 2019.

  1. Michael_R

    Michael_R

    Joined:
    Sep 6, 2018
    Posts:
    29
    Hello,


    I need to calculate local position of RH_HandEffector so that the Sphere (ADSPoint) has the same position as the camera.
    This script is meant for the (lean) Aim Down Sights Hand position

    I attached pictures where you can see the hierarchy for better understanding.


    My attempt:
    Code (CSharp):
    1. RH_HandEffector.transform.localPosition = RH_HandEffector.transform.InverseTransformPoint(Camera.transform.position -Sphere.transform.position);
     

    Attached Files:

    Last edited: May 19, 2019
unityunity