首页 > 其他 > 详细

物体的自转

时间:2017-07-06 18:03:19      阅读:272      评论:0      收藏:0      [点我收藏+]

第一种方式

   private GameObject center;

  //旋转

  center.transform.Rotate(new Vector3(0, -1, 0), Time.deltaTime * speed);

第二种方式

private void RotateSelf(GameObject obj,float speedSelf)
{

  //角轴
  var rotate = Quaternion.AngleAxis(Time.deltaTime * speedSelf, Vector3.up);
  obj.transform.rotation = rotate * obj.transform.rotation;
}

//调用方法

 RotateSelf(center.gameObject,-10f);

物体的自转

原文:http://www.cnblogs.com/Study088/p/7127057.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!