如何解决如何像youtube视频中的旋转物体那样旋转长圆柱物体? 统一
我想知道如何旋转长圆柱体对象,看起来像video中的旋转体一样。
void Update() {
time += Time.deltaTime;
float x = 4.57 f;
float y = 0;
float z = Mathf.Sin(time);
transform.position = new Vector3(x,y,z);
}
这是我的脚本,直到这里,我不知道该怎么做?
解决方法
您可能只有一个主要模型,其枢轴位于中心,而只需旋转Transform.Rotate
。
void Update() {
transform.Rotate(Time.deltatime,0);
}
您也可以使用transform.rotation
void Update(){
transform.rotation = new Quaternion(transform.rotation.x+Time.deltatime,transform.rotation.y,transform.rotation.z,transform.rotation.w);
}
//Note,I would just put transform.rotation into a new var,to make it easier.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。