daixinet

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

unity按照角度旋转

for (var idx = 1; idx <= 48; idx++)
{
Vector2 newDirection2 = Quaternion.AngleAxis(idx * 360/48, Vector3.forward) * direction;

var newBullet2 = Instantiate(bullet, bulletTransform.position, Quaternion.identity);
var bulletScript2 = newBullet2.GetComponent();
bulletScript2.shootingHorizontal = newDirection2.x;
bulletScript2.shootingVertical = newDirection2.y;
bulletScript2.enemyCteate = enemyCteate;
bulletScript2.player = player;
}

posted on 2023-05-02 00:35  daixinet.com  阅读(50)  评论(0)    收藏  举报