Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

scaling up position mimicry

Discussion in 'Scripting' started by Dragonbane07, Sep 17, 2017.

  1. Dragonbane07

    Dragonbane07

    Joined:
    Mar 14, 2016
    Posts:
    1
    i'm demoing a mechanical arm that copy's your arms movements in vr, I've built a small scale arm that are used as the "controls" but i'm struggling on scaling up the other arm. i want the controllable arm to be 100 times bigger than the controller arm. this would require each movement to also be scaled up by 100 times but i'm having trouble with this. here is the code i'm using
    Code (CSharp):
    1.    public Transform toFollow;
    2.     public Vector3 distance;
    3.     public Vector3 startPosfollow;
    4.     public Vector3 startPos;
    5.  
    6.     void Start()
    7.     {
    8.         startPosfollow = toFollow.position;
    9.         startPos = transform.position;
    10.     }
    11.     void Update()
    12.     {
    13.         transform.position = (toFollow.position - startPosfollow * 2) + startPos;
    14.         transform.rotation = toFollow.rotation;
    15.     }
    in this code im using a smaller scale (2 times the size) so i can see any problems better.