u3d 相机跟随角色行走

本文详细介绍了在Unity3D中如何设置和调整相机,使其能够完美地跟随角色进行平滑的行走动画,包括相机的距离、角度和限制等关键参数的设定方法。
摘要由CSDN通过智能技术生成
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFlow : MonoBehaviour
{
    //目标物体
    public GameObject target;
    //相机与目标物体的距离
    public float distance;
    //横向角度
    public float rotDegree = 0;
    public float rotSpeed = 0.2f;
    float rot; //弧度
    //纵向角度
    public float rollDegree = 30;
    public float rollSpeed = 0.2f;
    public float minRollDegree = 0;
    public float maxRollDegree = 70;
    float roll; //弧度
    //摄像机移动速度(滚轮控制)
    public float zoomSpeed = 1.5f;
    public float minDis = 8;
    public float maxDis = 22;

    // Use this for initialization
    void Start()
    {
        //target = GameObject.Find("tank");
        //GetTarget(target);
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(1))
        {
            Rotate();
            Roll();
        }

        Zoom();
        //角度转换成弧度
        rot &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值