当前位置:网站首页>Unity SKFramework框架(二十四)、Avatar Controller 第三人称控制
Unity SKFramework框架(二十四)、Avatar Controller 第三人称控制
2022-07-05 09:20:00 【CoderZ1010】
目录
一、简介

Avatar Controller适用于第三人称的人物控制,包括相机控制,目前初始版本v0.0.1包含对Avatar三个动画的控制:Idle静止、Walk行走、Sprint奔跑,通过Speed参数控制BlendTree,如图所示:

阈值分别如下:

该工具已经上传至我的开发框架SKFramework中,如图所示:


SKFramework框架开源地址:
https://github.com/136512892/SKFramework

二、使用说明
1.人物控制
为Avatar人物添加Avatar Controller组件,实现人物控制

Avatar移动通过Rigidbody刚体组件驱动,因此需要同时添加刚体组件,假设人物重70公斤,将Mass设为70,Freez Rotation设为true,如图所示:

为Avatar添加Collider碰撞器,并设置适当大小:


为Avatar添加Animator组件,并指定Animator Controller:

2.相机控制
为Camera相机添加Avatar Camera Controller组件,实现相机控制:

三、参数说明
1.Avatar Controller
Main Camera:主相机 用于跟随人物
Sprint Key:加速按键 按下该键时 人物进入奔跑状态
Walk Threshold:行走阈值 与Animator BlendTree中阈值相对应
Sprint Threshold:奔跑阈值 与Animator BlendTree中阈值相对应
Rotate Speed:旋转值使用插值方式 插值的速度
2.Camera Controller
Avatar:Avatar人物
Horizontal Sensitivity:鼠标水平方向灵敏度
Vertical Sensitivity:鼠标垂直方向灵敏度
Rot Y Min Limit:旋转y值的最小值限制
Rot Y Max Limit:旋转y值的最大值限制
Rotation Lerp Time:插值到目标旋转值所需的时间
Height:相机距人物的高度
Min Distance Limit:相机距人物最小距离限制
Max Distance Limit:相机距人物最大距离限制
Scroll Sensitivity:鼠标滚轮滚动的灵敏度
Invert Scroll Direction:是否翻转鼠标滚轮滚动的方向
Obstacle Layer:避障检测时障碍物的Layer层
其中Obstacle Layer用于避障检测,例如在场景中放置一个障碍物,将其Layer层级指定为Default,假设它是障碍层:

将Obstacle Layer也设为Default:

如图所示,当相机与人物之间被障碍物遮挡时,相机会向前拉进越过障碍物:

边栏推荐
- Codeforces Round #648 (Div. 2) E.Maximum Subsequence Value
- AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
- Figure neural network + comparative learning, where to go next?
- 2311. Longest binary subsequence less than or equal to K
- My life
- Introduction Guide to stereo vision (1): coordinate system and camera parameters
- NIPS2021 | 超越GraphCL,GNN+对比学习的节点分类新SOTA
- 浅谈Label Smoothing技术
- Multiple linear regression (gradient descent method)
- C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边
猜你喜欢

Summary of "reversal" problem in challenge Programming Competition

【ManageEngine】如何利用好OpManager的报表功能

C language - input array two-dimensional array a from the keyboard, and put 3 in a × 5. The elements in the third column of the matrix are moved to the left to the 0 column, and the element rows in ea

生成对抗网络

信息與熵,你想知道的都在這裏了

LeetCode 556. 下一个更大元素 III

一文详解图对比学习(GNN+CL)的一般流程和最新研究趋势

Progressive JPEG pictures and related

利用请求头开发多端应用

混淆矩阵(Confusion Matrix)
随机推荐
编辑器-vi、vim的使用
Node collaboration and publishing
OpenGL - Model Loading
Information and entropy, all you want to know is here
利用请求头开发多端应用
Wxml template syntax
Svg optimization by svgo
Explain NN in pytorch in simple terms CrossEntropyLoss
Multiple linear regression (gradient descent method)
Codeforces Round #648 (Div. 2) D. Solve The Maze
优先级队列(堆)
Applet customization component
Introduction Guide to stereo vision (1): coordinate system and camera parameters
Solution to the problems of the 17th Zhejiang University City College Program Design Competition (synchronized competition)
What is a firewall? Explanation of basic knowledge of firewall
Wxss template syntax
AUTOSAR从入门到精通100讲(103)-dbc文件的格式以及创建详解
notepad++
[ctfhub] Title cookie:hello guest only admin can get flag. (cookie spoofing, authentication, forgery)
C # image difference comparison: image subtraction (pointer method, high speed)