Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Vector3 nowPos;
- private Vector3 tarPos;
- private float smoothMoveT = 1.0f;
- public float smoothMoveSpeed = 1.0f;
- public float smoothMoveDuration = 0.3f;
- public void smooth(Vector3 newTarPos)
- {
- nowPos = transform.position;
- tarPos = newTarPos;
- smoothMoveT = 0.0f;
- }
- void Update()
- {
- if (smoothMoveT < 1.0f)
- {
- smoothMoveT += ((smoothMoveSpeed*Time.timeScale)/smoothMoveDuration) * Time.deltaTime;
- transform.position = Vector3.Lerp(nowPos, tarPos, smoothMoveT);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment