unity 3d怎么使模型随着鼠标的滑动而改变旋转角度
2个回答
展开全部
public class xunzhuan : MonoBehaviour {
public Transform target;
private int MouseWheelSensitivity = 1;
private int MouseZoomMin = 1;
private int MouseZoomMax = 5;
private float normalDistance = 3;
private Vector3 normalized;
private float xSpeed = 250.0f;
private float ySpeed = 120.0f;
private int yMinLimit = -20;
private int yMaxLimit = 80;
private float x = 0.0f;
private float y = 0.0f;
private Vector3 screenPoint;
private Vector3 offset;
private Quaternion rotation = Quaternion.Euler(new Vector3(30f, 0f, 0f));
private Vector3 CameraTarget;
void Start ( )
{
CameraTarget = target.position;
//float z = target.transform.position.z - 3.95f;
float z = target.transform.position.z - normalDistance;
transform.position = rotation * new Vector3(transform.position.x, transform.position.y, z);
//transform.position = rotation * new Vector3(transform.position.x, transform.position.y, target.transform.position.z - 3.95f);
public Transform target;
private int MouseWheelSensitivity = 1;
private int MouseZoomMin = 1;
private int MouseZoomMax = 5;
private float normalDistance = 3;
private Vector3 normalized;
private float xSpeed = 250.0f;
private float ySpeed = 120.0f;
private int yMinLimit = -20;
private int yMaxLimit = 80;
private float x = 0.0f;
private float y = 0.0f;
private Vector3 screenPoint;
private Vector3 offset;
private Quaternion rotation = Quaternion.Euler(new Vector3(30f, 0f, 0f));
private Vector3 CameraTarget;
void Start ( )
{
CameraTarget = target.position;
//float z = target.transform.position.z - 3.95f;
float z = target.transform.position.z - normalDistance;
transform.position = rotation * new Vector3(transform.position.x, transform.position.y, z);
//transform.position = rotation * new Vector3(transform.position.x, transform.position.y, target.transform.position.z - 3.95f);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
transform.translate
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询