Skip to content

Instantly share code, notes, and snippets.

@curious-username
Created December 1, 2021 04:37
Show Gist options
  • Save curious-username/1a5ce3d940bba83195264e30d6b4c666 to your computer and use it in GitHub Desktop.
Save curious-username/1a5ce3d940bba83195264e30d6b4c666 to your computer and use it in GitHub Desktop.
Missile Movement
void Movement()
{
transform.Translate(Vector2.down * _speed * Time.deltaTime);
Vector3 direction = _playerLocation.transform.position - transform.position;
float rot_z = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rot_z + 90);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment