Lerp rotation

Asked 2 years ago, Updated 2 years ago, 100 views

Can't you rotate it based on a point other than the center of the object when you rotate it using lerp?

unity

2022-09-22 12:20

1 Answers

public class RotateAroundTest : MonoBehaviour {

    Vector3 point;

    // // Use this for initialization
    void Start () {
        // // initial position
        transform.position = new Vector3(0.0f, 0.0f, 5.0f);

        // // center position (origin)
        point = new Vector3(0.0f, 0.0f, 0.0f);
    }

    // // Update is called once per frame
    void Update () {
        transform.RotateAround(point, Vector3.up, Time.deltaTime * 50); 
    }
}


2022-09-22 12:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.