物品展示必备代码(旋转与缩放代码…
来源:互联网 发布:期货日内交易策略源码 编辑:程序博客网 时间:2024/05/17 03:41
using UnityEngine;
public class MouseFollowRotation : MonoBehaviour{
publicTransformtarget;
public floatxSpeed=200, ySpeed=200,mSpeed=10;
public floatyMinLimit=-50,yMaxLimit=50;
public floatdistance=7, minDistance=2,maxDistance=30;
//boolneedDamping = false;
public boolneedDamping=true;
floatdamping = 5.0f;
public floatx = 0.0f;
public floaty = 0.0f;
public voidSetTarget( GameObject go)
{
target = go.transform;
}
// Use thisfor initialization
void Start() {
Vector3 angles =transform.eulerAngles;
x = angles.y;
y = angles.x;
}
// Update iscalled once per frame
voidLateUpdate()
{
if(target)
{
//use the light button of mouse to rotate thecamera
if( Input.GetMouseButton(0))
{
public class MouseFollowRotation : MonoBehaviour{