当前位置:网站首页>Common technologies of unity
Common technologies of unity
2022-07-05 04:53:00 【yaohuiyaoo】
1.3D Pickup Technology
The ray is 3D A point in the world emits in one direction without end . stay unity3d Once our rays collide with other colliders , The rays stop emitting .
In the process of game making, we can judge whether the rays collide , And we can judge who the ray collided with . It has a wide range of applications , For example, it is used to judge whether the target is hit in the shooting game
ray(origin:vector,direction:vector3)
ray.origin Indicates the starting point of the ray
Ray.direction: Indicates the direction of the ray
Case a : Emit a ray from the origin
void Update(){
Ray ray=new Ray(Vector3.zero,transform.position);
RaycastHit hit;
Physics.Raycast(ray,out hit,100);
debug.DrawLine(ray.origin,hit.point);
}
Case 2: click the left mouse button to clone the game object
if(Input.GetMouseButtonDown(0)){
Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray,out hit)){
Instantiate(cube,hit.point,Quaternion.identity);
}
}
Wireless length :Mathf.Infinity
Find the layer with the specified name
1<<LayerMask.NameToLayer("cube");
( among << Sinister 1 Open for indication , Not binary, move one bit to the left ;0 Indicates that there is no such layer)`
Two , Character controller
Unity3D It encapsulates a very useful component to realize the development of first person perspective and third person perspective Games , We call it the character controller component , Almost no need to write a line of code to complete all operations -CharacterController( Character controller ). So it's also U3D A class in , It can control the movement of objects .
CharacterController Components :
Property panel :Slope Limit The maximum angle that the character can climb , If you want to climb higher than the angle set by the current box , Can't climb up , You must set a larger value in this box to
step offset; The height of the highest step , If the step height in the game is less than the value in this box , Characters can go up the steps in the game
Skin Width: The width of the skin that the two colliders can penetrate each other
min move distance: Move the minimum step distance
center The size relative to the center point of the object
height: Height of capsule
Radius: Radius of capsule
The character components of the game object .SimpleMve(new Vector(0,0,0)) Plane movement , With its own Collider and gravity
The character components of the game object .Move() No gravity , With impactor
Collision monitoring
void OnControllerColliderHit(ControllerColliderHit hit){
}
边栏推荐
- China needle coke industry development research and investment value report (2022 Edition)
- 2022 thinking of mathematical modeling a problem of American college students / analysis of 2022 American competition a problem
- CUDA Programming atomic operation atomicadd reports error err:msb3721, return code 1
- Error statuslogger log4j2 could not find a logging implementation
- 中国AS树脂市场调研与投资预测报告(2022版)
- AutoCAD - Center zoom
- A survey of automatic speech recognition (ASR) research
- 数论函数及其求和 待更新
- Variable category (automatic, static, register, external)
- Wan broadband access technology V EPON Technology
猜你喜欢

54. Spiral matrix & 59 Spiral matrix II ●●

2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem

介绍汉明距离及计算示例

A survey of automatic speech recognition (ASR) research

Minor spanning tree

【acwing】528. cheese

2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis

3dsmax snaps to frozen objects
![[crampon game] MC tutorial - first day of survival](/img/81/82034c0382f545c39bd8c15f132ec7.jpg)
[crampon game] MC tutorial - first day of survival

AutoCAD - command repetition, undo and redo
随机推荐
【acwing】240. food chain
AutoCAD - scaling
【Leetcode】1352. 最后 K 个数的乘积
AutoCAD -- dimension break
[Business Research Report] Research Report on male consumption trends in other economic times -- with download link
Sixth note
Function overloading
How to choose a panoramic camera that suits you?
2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
#775 Div.1 C. Tyler and Strings 组合数学
China as resin Market Research and investment forecast report (2022 Edition)
Solutions and answers for the 2021 Shenzhen cup
2021-10-29
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
AutoCAD - graphic input and output
A survey of automatic speech recognition (ASR) research
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
Flink集群配置
AutoCAD - stretching
Setting up redis cluster cluster under Windows