In Unity, how to use ForceMode.Acceleration?

Viewed 51

I want the object to move with torque.. without other moving transform code.

but when start unity, the rock is rolling but it is place

https://www.youtube.com/results?search_query=unity+forcemode.acce

If you watch the video of 24:52, its what I want.

enter image description here

this is my code:

void Awake()
{
    rigid = GetComponent<Rigidbody>();


    StartCoroutine(GainPowerTimer());
    StartCoroutine(GainPower());
}

IEnumerator GainPowerTimer()
{
    yield return new WaitForSeconds(2.2f);
    isShoot = true;
}

IEnumerator GainPower()
{
    while (!isShoot)
    {
        angularPower += 0.02f;
        scaleValue += 0.005f;

        transform.localScale = Vector3.one * scaleValue;

        rigid.AddTorque(transform.right * angularPower, ForceMode.Acceleration);

        yield return null;
    }
}
0 Answers
Related