using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateTank2 : MonoBehaviour
{
public Transform Selftransform;
private Vector3 _force;
private int rotate = 1;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
Selftransform.position += _force;
if (rotate == 1)
{
transform.Rotate(0, 0, 2);
}
if (Input.GetKey(KeyCode.D))
{
rotate = 0;
_force += (Selftransform.up * Time.deltaTime) * 0.1f;
}
else
{
_force = Vector3.Lerp(_force, Vector3.zero, 10);
rotate = 1;
}
}
}