Search Unity

How to scale an object and at same time fix the position ?

Discussion in 'General Discussion' started by tahatlal, Mar 30, 2021.

  1. tahatlal

    tahatlal

    Joined:
    May 22, 2020
    Posts:
    1
    I'm trying to make a signal that expand like normal signal and move forward with the speed of sound ...
    this is for research helping my prof. to simulate this thing ...
    i tried to use local scale but always changing the position of my object over time ...

    Code (CSharp):
    1.  gameObject.transform.localScale +=new Vector3(0.3f,0.3f,0.3f);
    2.  
    3.  gameObject.transform.position += new Vector3(_x, _y, _z);
    please help :(

    my prefap: https://drive.google.com/file/d/1nvgbHgNpOX6mPn76H3c2LfWfG8rYy9I1/view?usp=sharing
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Parent it to an empty object in such way that the parent is located at the point from which the object should expand, and scale the parent.

    upload_2021-3-30_14-57-28.png
     
    lmbarns, drewjosh, CorWilson and 2 others like this.
  3. drewjosh

    drewjosh

    Joined:
    Sep 24, 2019
    Posts:
    30
    You are a genius my friend :)