当前位置:网站首页>Unity skframework framework (24), avatar controller third person control

Unity skframework framework (24), avatar controller third person control

2022-07-05 09:24:00 CoderZ1010

Catalog

One 、 brief introduction

Two 、 Instructions

1. Character control

2. Camera control

3、 ... and 、 Parameter description

1.Avatar Controller

2.Camera Controller


One 、 brief introduction

Avatar Controller Suitable for third person character control , Including camera control , Current initial version v0.0.1 Contains the Avatar Control of three animations :Idle static 、Walk walk 、Sprint Running , adopt Speed Parameter control BlendTree, As shown in the figure :

The thresholds are as follows :

The tool has been uploaded to my development framework SKFramework in , As shown in the figure :

SKFramework Framework open source address :

https://github.com/136512892/SKFramework

Two 、 Instructions

1. Character control

by Avatar Add characters Avatar Controller Components , Realize character control

Avatar Move through Rigidbody Rigid body components drive , Therefore, you need to add rigid body components at the same time , Suppose the character is heavy 70 kg , take Mass Set to 70,Freez Rotation Set to true, As shown in the figure :

by Avatar add to Collider Impactor , And set the appropriate size :

by Avatar add to Animator Components , And designate Animator Controller:

2. Camera control

by Camera Camera add Avatar Camera Controller Components , Realize camera control :

3、 ... and 、 Parameter description

1.Avatar Controller

Main Camera: The main camera Used to follow characters
Sprint Key: Acceleration button When pressing this key The character enters the running state
Walk Threshold: Walking threshold And Animator BlendTree The medium threshold corresponds to
Sprint Threshold: Running threshold   And Animator BlendTree The medium threshold corresponds to
Rotate Speed: The rotation value is interpolated The speed of interpolation

2.Camera Controller

Avatar:Avatar figure
Horizontal Sensitivity: Mouse horizontal sensitivity
Vertical Sensitivity: Mouse vertical sensitivity
Rot Y Min Limit: rotate y The minimum limit of the value
Rot Y Max Limit: rotate y Maximum limit of value
Rotation Lerp Time: The time required to interpolate to the target rotation value
Height: The height of the camera from the person
Min Distance Limit: The minimum distance between the camera and the person
Max Distance Limit: The maximum distance between the camera and the person
Scroll Sensitivity: Sensitivity of mouse wheel rolling
Invert Scroll Direction: Whether to turn the direction of the mouse wheel
Obstacle Layer: Obstacles in obstacle avoidance detection Layer layer

among Obstacle Layer For obstacle avoidance detection , For example, place an obstacle in the scene , Put it Layer The level is specified as Default, Suppose it is an obstacle :

take Obstacle Layer Also set to Default:

As shown in the figure , When the camera and the person are blocked by obstacles , The camera will pull forward over the obstacle :

原网站

版权声明
本文为[CoderZ1010]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050920537026.html