Making a 2d game:
I want to move character on circular surface only in one direction?
Script attached to child object is:
public GameObject ball;
float speed=2f;
// Start is called before the first frame update
void Start()
{
GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
Left();
}
void Left()
{
if(Input.GetKey(KeyCode.LeftArrow))
{
ball.GetComponent<Rigidbody2D>().AddForce(Vector3.forward * speed);
//transform.Rotate(Vector2.left);
}
}
Note: character will move on a circular surface in only one direction...
Image reference: