unity3d鼠标旋转视角自由视角代码

更新时间:2023-06-17 12:13:45 阅读: 评论:0

unity3d⿏标旋转视⾓⾃由视⾓代码
data是什么意思//把下⾯的代码挂在摄像机中
//摄像机跟随的主⾓物体
public Transform target;
//摄像机距离模型的默认距离
public float distance = 20.0f;
//⿏标在x轴和y轴⽅向移动的速度
float x;
float y;
//⿏标在x和y轴⽅向移动的速度
float xSpeed = 250.0f;
卸妆技巧
float ySpeed = 120.0f;
void Start()
{
if (gameObject.GetComponent<Rigidbody>() != null)
{
to be or not to begameObject.GetComponent<Rigidbody>().freezeRotation = true;
}
}
void LateUpdate()
{
if (target)
onclick>right是什么意思
{
//我的分析:1.根据垂直⽅向的增减量修改摄像机距离参照物的距离
distance += Input.GetAxis("Vertical");
//根据⿏标移动修改摄像机的⾓度
x += Input.GetAxis("Mou X") * xSpeed * 0.02f;alcor
y -= Input.GetAxis("Mou Y") * ySpeed * 0.02f;
Quaternion rotation = Quaternion.Euler(y, x, 0);
Vector3 position = rotation * new Vector3(0.0f, 0.0f, -distance) + target.position;雅思口语练习
//设置摄像机的位置与旋转
纽约州立大学
bread的音标
transform.position = position;
}
}
void Update()
screaming
{
}
}

本文发布于:2023-06-17 12:13:45,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/148192.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:摄像机   距离   修改   增减量   技巧   练习   纽约   卸妆
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图