当前位置:网站首页>Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
2022-07-02 13:07:00 【CoderZ1010】
Catalog
1. Keyboard control translation
4. Rotate around the center of view
7. Rotate around the center of view when idle
One 、 brief introduction
FreeCameraController It's for God's perspective 、 Camera control script with free view , Support at the same time Input System Package(New) and Input Manager(Old) new 、 The old two input systems .

The tool has been uploaded to my framework SKFramework Development toolbox in , As shown in the figure .


The framework is already in Github Open source , Address :https://github.com/136512892/SKFramework

Two 、 function
1. Keyboard control translation
Via keyboard W、S、A、D、E、Q Press the key to move forward 、 after 、 Left 、 Right 、 On 、 Translation in the down direction :

2. Mouse control translation
Pan by holding down the left mouse button and dragging :

3. Zoom in and out
Through the scrolling of the mouse wheel, the angle of view is shortened or widened :

4. Rotate around the center of view
By holding down the right mouse button and dragging, the viewing angle rotates around the center :

5. Perspective focus
By calling Focus Function to realize the focus of perspective :
/// <summary>
/// focusing
/// </summary>
/// <param name="position"> Target location </param>
/// <param name="rotation"> Target rotation </param>
/// <param name="duration"> Duration </param>
public void Focus(Vector3 position, Vector3 rotation, float duration);
6. Activity area restrictions
By enabling IsRangeClamped To limit the scope of activities :

By setting xMinValue...zMaxValue Adjust the range of activities , As shown in the figure , The area formed by the green line is the range of activities , The camera will not move beyond this area :

7. Rotate around the center of view when idle
When the user does not operate for a certain period of time , Go idle , The camera automatically rotates around the center of view , This function is enabled by enableAutoIdle Realization :


3、 ... and 、 Core variables

toggle: Switch of control system
isRangeClamped: Whether to enable active area restriction
xMinValue、xMaxValue: stay x Range of active areas on the axis , When isRangeClamped by true It works
yMinValue、yMaxValue: stay y Range of active areas on the axis , When isRangeClamped by true It works
zMinValue、zMaxValue: stay z Range of active areas on the axis , When isRangeClamped by true It works
translateSpeed: Translation speed
boost: Acceleration factor , When pressing... On the left of the keyboard Shift Key will accelerate the movement
positionLerpTime: The time required for coordinate interpolation to the target value
rotationLerpTime: The time required to rotate the interpolation to the target value
mouseMovementSensitivity: The sensitivity of dragging and moving with the left mouse button
mouseRotationSensitivityCurve: Right mouse button drag rotation sensitivity
mouseScrollMoveSpeed: The speed at which the viewing angle gets closer and farther when the mouse wheel rolls
invertScrollDirection: Whether to reverse the direction in which the viewing angle is closer and farther when the mouse wheel is scrolled
enableAutoIdle: Whether to enable automatic idle
idleWaitTime: When the user has no operation within this period , Go idle , The camera automatically rotates around the center of view , When enableAutoIdle by true It works
idleRotateSpeed: When idle , The speed of rotation around the center of view
边栏推荐
- Execute any method of any class through reflection
- NTMFS4C05NT1G N-CH 30V 11.9A MOS管,PDF
- Js6day (search, add and delete DOM nodes. Instantiation time, timestamp, timestamp cases, redrawing and reflow)
- Modular commonjs es module
- Jerry's watch reads the alarm clock [chapter]
- moon
- Dijkstra AcWing 850. Dijkstra finding the shortest circuit II
- Js2day (also i++ and ++i, if statements, ternary operators, switch, while statements, for loop statements)
- The coloring method determines the bipartite graph acwing 860 Chromatic judgement bipartite graph
- 完全自主可控三维云CAD:CrownCAD便捷的命令搜索,快速定位所需命令具体位置。
猜你喜欢

Interval DP acwing 282 Stone merging

Modular commonjs es module

Js10day (API phased completion, regular expression introduction, custom attributes, filtering sensitive word cases, registration module verification cases)

VIM super practical guide collection of this one is enough

C#修饰符

阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)

Unity skframework framework (XV), singleton singleton

C modifier

面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六

The coloring method determines the bipartite graph acwing 860 Chromatic judgement bipartite graph
随机推荐
Package management tools
Jerry's weather direction coding table [chapter]
Linear DP acwing 897 Longest common subsequence
阿里初面被两道编程题给干掉,再次内推终上岸(已拿电子offer)
The UVM Primer——Chapter2: A Conventional Testbench for the TinyALU
基于STM32的OLED 屏幕驱动
js1day(输入输出语法,数据类型,数据类型转换,var和let区别)
[opencv learning] [moving object detection]
Heap acwing 839 Simulated reactor
Jerry's weather code table [chapter]
Linear DP acwing 899 Edit distance
net share
Unity SKFramework框架(十六)、Package Manager 開發工具包管理器
传感器 ADXL335BCPZ-RL7 3轴 加速度计 符合 RoHS/WEEE
OLED screen driver based on stm32
Hash table acwing 840 Simulated hash table
js4day(DOM开始:获取DOM元素内容,修改元素样式,修改表单元素属性,setInterval定时器,轮播图案例)
Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?
Jerry's weather code table [chapter]
Fundamentals of face recognition (facenet)