Question by
Relo999 · May 03, 2016 at 06:05 PM ·
c#lerprotatearoundmovetowards
How can I make smooth steps around an object?
How can I make smooth steps around a object that are the same distances apart no matter how far you are from that object?
My current code works but isn't smooth and isn't perfectly circling (although I like that).
using UnityEngine;
using System.Collections;
public class Move1 : MonoBehaviour {
private Vector3 Player2Pos = new Vector3(0,0,0);
private Vector3 sStep = new Vector3(1,0,0);
// Update is called once per frame
void Update () {
Player2Pos = GameObject.FindGameObjectWithTag("Player2").transform.position;
if (Input.GetKeyDown(KeyCode.DownArrow)){
transform.LookAt(Player2Pos);
transform.Translate (sStep*-1);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Doesn't work MoveTowards and Lerp 1 Answer
MoveTowards and Lerp not working 1 Answer
MoveTowards not moving accurately. Getting stuck on target. 2 Answers
If statement not getting called after Lerping a Scale 1 Answer
Text Objects do Lerp 0 Answers