当前位置:网站首页>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
边栏推荐
- Heap acwing 839 Simulated reactor
- [opencv learning] [image filtering]
- Unity skframework Framework (XVI), package manager Development Kit Manager
- Counter attack of flour dregs: MySQL 66 questions, 20000 words + 50 pictures in detail! A little six
- Do you know all the interface test interview questions?
- Word efficiency guide - word's own template
- Jerry's watch time synchronization [chapter]
- JS iterator generator asynchronous code processing promise+ generator - > await/async
- 正确遍历EntryList方法
- Unity skframework framework (XXI), texture filter map resource filtering tool
猜你喜欢

PR usage skills, how to use PR to watermark?

Unity skframework framework (XIII), question module
![[opencv learning] [moving object detection]](/img/2e/9b437b7fe22f1d57334529eda68e37.jpg)
[opencv learning] [moving object detection]

Tencent three sides: in the process of writing files, the process crashes, and will the file data be lost?

挥发性有机物TVOC、VOC、VOCS气体检测+解决方案

js5day(事件监听,函数赋值给变量,回调函数,环境对象this,全选反选案例,tab栏案例)

Async/await asynchronous function

Domestic free data warehouse ETL dispatching automation operation and maintenance expert taskctl

Apply lnk306gn-tl converter, non isolated power supply

spfa AcWing 851. SPFA finding the shortest path
随机推荐
Js1day (syntaxe d'entrée / sortie, type de données, conversion de type de données, Var et let différenciés)
[opencv learning] [moving object detection]
三面阿里,有惊无险成功拿到offer定级P7,只能说是真的难
C modifier
Oracle从入门到精通(第4版)
挥发性有机物TVOC、VOC、VOCS气体检测+解决方案
Lucky numbers in the [leetcode daily question] matrix
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
Js2day (also i++ and ++i, if statements, ternary operators, switch, while statements, for loop statements)
Unity SKFramework框架(十二)、Score 计分模块
West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials
Fundamentals of face recognition (facenet)
8 examples of using date commands
日本赌国运:Web3.0 ,反正也不是第一次失败了!
国产免费数据仓库ETL调度自动化运维专家—TASKCTL
屠榜多目标跟踪!BoT-SORT:稳健的关联多行人跟踪
Jerry's watch ringtone audition [article]
PXE installation UOS prompt NFS over TCP not available from 10 x.x.x
Linear DP acwing 899 Edit distance
Efficiency comparison between ArrayList and LinkedList