位置: 编程技术 - 正文

摄像机跟随与摄像机晃动(摄像机跟随与摄像的区别)

编辑:rootadmin
using UnityEngine;using System.Collections;public class CameraFollows : MonoBehaviour {private Vector3 position;public Transform target; public float distance ; public float targetHeight; public float PitchAngle; private float x = 0.0f; private float y = 0.0f; private float cameraShakeImpulse; void Start () { var angles = transform.eulerAngles; x = angles.x; y = angles.y;cameraShakeImpulse= 1; } void LateUpdate () { if(!target) return; y = target.eulerAngles.y; Quaternion rotation = Quaternion.Euler(x-PitchAngle, y, 0); transform.rotation = rotation; Vector3 position = target.position - (rotation * Vector3.forward * distance &#; new Vector3(0,-targetHeight,0)); transform.position = position ;ShakeCamera ();print (transform .position);}//摄像机震动void ShakeCamera (){transform.position &#;= new Vector3 (0, Random.Range (-cameraShakeImpulse, cameraShakeImpulse), Random.Range (-cameraShakeImpulse, cameraShakeImpulse));cameraShakeImpulse -= Time.deltaTime * cameraShakeImpulse * 4f;if (cameraShakeImpulse < 0.f) {cameraShakeImpulse = 0;}}

推荐整理分享摄像机跟随与摄像机晃动(摄像机跟随与摄像的区别),希望有所帮助,仅作参考,欢迎阅读内容。

摄像机跟随与摄像机晃动(摄像机跟随与摄像的区别)

文章相关热门搜索词:监控跟随拍摄,摄像机 跟踪,摄像机自动跟随,摄像机 跟踪,摄像机跟随与摄像的区别,摄像机 跟踪,摄像机跟随与摄像头区别,摄像机跟随与摄像头区别,内容如对您有帮助,希望把文章链接给更多的朋友!

当前动画的控制 //stateInfo.fullPathHash:判断当前动画状态;Animator.StringToHash(BaseLayer.Kick):获取kick动画的序列号;!anim.IsInTransition(0):触发的动画不是当前状态的动画时

控制角色jump //控制角色向上跳跃IEnumeratorJumpMove(){floatcurrentHeight=0;rig.useGravity=false;while(currentHeightjumpHeight){transform.position=Vector3.up*jumpPower*Time.deltaTime;currentHeight=jumpPower*

控制角色平滑转弯 //控制角色进行向左或向右的度旋转IEnumeratorRotateDirection(boolisLeft){isRotate=true;intdirection=0;if(isLeft){direction=-1;}else{direction=1;}floatrotateAngles=f;while(rotateAngles

本文链接地址:https://www.jiuchutong.com/biancheng/372789.html 转载请保留说明!

上一篇:跑酷角色左右移控制(跑酷角色左右移动怎么弄)

下一篇:当前动画的控制(在动画制作中一般默认帧数选择为)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络