-4

i trying to swing an object by using Linear interpolation.

enter image description here

Mohit Gandhi
  • 175
  • 1
  • 1
  • 6

1 Answers1

0

Use RotateAround function of transform:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.RotateAround(transform.position, Vector3.up, alpha);
    }
}

where alpha is the angle you wish to rotate, and you need update this to make smooth rotations.

enter image description here

David
  • 15,894
  • 22
  • 55
  • 66