DOMove: Why, oh "Y" is my Y-value decreasing?
« on: May 13, 2016, 07:04:11 AM »
Apologies for the "dad joke" subject title.

My graph shown on the left should transform into the graph shown on the right. Instead, it transforms to the graph in the middle, which is lower on the y-axis. The graph is constructed from four gameobjects, each one a simple scaled cube with its pivot on its lowest face.

The gameobjects have scaled properly and have moved relative to each other as expected... but they're lower on the y-axis than expected.

I'm using DOTween's DOMove and DOScale to get a visually stacked graph to transform its internal segments. Using a regular transform will also cause similar behavior, so I don't think it's a DOTween specific problem. Commenting out DOScale did not change the unwanted transform behavior.

What am I missing which could cause this y-axis movement?

Thank you in advance for any help or insight!

Code: (CSharp) [Select]
    public override void StartShowData ()
        minimalDist = trad_24_minimal_y - trad_24_minimal.transform.position.y;
        moderateDist = trad_24_moderate_y - trad_24_moderate.transform.position.y;
        severeDist = trad_24_severe_y - trad_24_severe.transform.position.y;
        cripplingDist = trad_24_crippled_y - trad_24_crippled.transform.position.y;

        Debug.Log ("start y: " + trad_24_minimal.transform.position.y + ", to y: " + trad_24_minimal_y + ", totalling " + minimalDist);
        trad_24_minimal.transform.DOMove (new Vector3 (trad_24_minimal.transform.position.x, trad_24_minimal_y, trad_24_minimal.transform.position.z), _transDuration, false);
        trad_24_minimal.transform.DOScaleY (trad_24_minimal_scale, _transDuration);
        Debug.Log ("start y: " + trad_24_moderate.transform.position.y + ", to y: " + trad_24_moderate_y + ", totalling " + moderateDist);
        trad_24_moderate.transform.DOMove (new Vector3 (trad_24_moderate.transform.position.x, trad_24_moderate_y, trad_24_moderate.transform.position.z), _transDuration, false);
        trad_24_moderate.transform.DOScaleY (trad_24_moderate_scale, _transDuration);

        Debug.Log ("start y: " + trad_24_severe.transform.position.y + ", to y: " + trad_24_severe_y + ", totalling " + severeDist);
        trad_24_severe.transform.DOMove (new Vector3 (trad_24_severe.transform.position.x, trad_24_severe_y, trad_24_severe.transform.position.z), _transDuration, false);
        trad_24_severe.transform.DOScaleY (trad_24_severe_scale, _transDuration);

        Debug.Log ("start y: " + trad_24_crippled.transform.position.y + ", to y: " + trad_24_crippled_y + ", totalling " + cripplingDist);
        trad_24_crippled.transform.DOMove (new Vector3 (trad_24_crippled.transform.position.x, trad_24_crippled_y, trad_24_crippled.transform.position.z), _transDuration, false);
        trad_24_crippled.transform.DOScaleY (trad_24_crippled_scale, _transDuration);


Re: DOMove: Why, oh "Y" is my Y-value decreasing?
« Reply #1 on: May 31, 2016, 09:17:28 AM »
For what it's worth, the error was me; the method was using global values and the numbers I needed were local.