#Modifying Player Speed to not be impacted by Time.timeScale

1 messages · Page 1 of 1 (latest)

fickle palm
#

Good afternoon all! I mistakenly started a post in unity-talk but I think here would be better suited for future questions... I have the following code:

IEnumerator WaitCounter()
    {
        this.transform.position = new Vector3(this.transform.position.x, -2, this.transform.position.z);
        if(this.gameObject.transform.parent.childCount == 1)
        {
            Time.timeScale = 0;
            PostProcessing.SetActive(false);
            waitCompleted = true;
        }
        else {
            Time.timeScale = .25f;
            yield return new WaitForSecondsRealtime(1.5f);
            Time.timeScale = 1f;
            PostProcessing.SetActive(false);
            waitCompleted = true;
        }
    }

I was informed that I could use Time.unscaledDeltaTime for objects that I do not want to be impaired, mainly the player. I am not really sure how I implement something like that if I am also using the Animator for character movement...is that possible?

abstract flower
#

Change the Animator update mode to unscaled

fickle palm
#

Got it for the animations...what if it were using like this...

void Update()
    {
    MoveHero();
    }
private void MoveHero()
    {
        float xValue = moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime;
        float yValue = moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime;
        transform.Translate(xValue, 0, yValue);
    }

My understanding of the concept is as follows: that Time.timeScale is how fast Time is actually moving where Time.DeltaTime is the amount of time that has passed from the previous frame to the current from...is that an accurate base understanding?

abstract flower
#

Time.DeltaTime is the amount of time that has passed from the previous frame to the current from
Yes