I have 1 object
I need that object
Rotate continues while object move PointA to PointB
Then wait for 3 second
Then reverse rotation while same object move PointB to PointA.
Here is code for move PointA to PointB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MovingPlatform : MonoBehaviour
{
public Transform movingPlatform;
public Transform position1;
public Transform position2;
public Vector3 newPosition;
public string currentState;
public float smooth;
public float resetTime;
private void Start()
{
ChangeTarget();
}
private void FixedUpdate()
{
movingPlatform.position = Vector3.Lerp(movingPlatform.position, newPosition, smooth * Time.deltaTime);
}
void ChangeTarget()
{
if (currentState == "Moving To Position 1")
{
currentState = "Moving To Position 2";
newPosition = position2.position;
}
else if (currentState == "Moving To Position 2")
{
currentState = "Moving To Position 1";
newPosition = position1.position;
}
else if (currentState == "")
{
currentState = "Moving To Position 2";
newPosition = position2.position;
}
Invoke("ChangeTarget", resetTime);
}
}
but i need rotation…
so, how can i do it… any idea…