当前位置:网站首页>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){
}
边栏推荐
- An article takes you to thoroughly understand descriptors
- 2020-10-27
- 質量體系建設之路的分分合合
- [groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
- Function overloading
- AutoCAD - window zoom
- PR first time
- 2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis
- 49 pictures and 26 questions explain in detail what is WiFi?
- 介绍汉明距离及计算示例
猜你喜欢
![[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)](/img/03/329adb314606f29c8a4cb2260e84c8.jpg)
[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)

2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis

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

669. Prune binary search tree ●●

质量体系建设之路的分分合合

AutoCAD - Center zoom

QT Bluetooth: a class for searching Bluetooth devices -- qbluetooth devicediscoveryagent

Pdf to DWG in CAD

CUDA Programming atomic operation atomicadd reports error err:msb3721, return code 1
![[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)](/img/1b/1fa2ebc9a6c5d271c9b39f5e508fb0.jpg)
[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)
随机推荐
Thinking of 2022 American College Students' mathematical modeling competition
3dsmax2018 common operations and some shortcut keys of editable polygons
PostgreSQL 超越 MySQL,“世界上最好的编程语言”薪水偏低
2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem
jmeter -- 分布式压测
[crampon programming] lintcode decoding Encyclopedia - 1100 strange printer
China as resin Market Research and investment forecast report (2022 Edition)
AutoCAD - isometric annotation
QT Bluetooth: a class for searching Bluetooth devices -- qbluetooth devicediscoveryagent
[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)
Inline built-in function
Reading and visualization of DICOM, MHD and raw files in medical imaging
XSS injection
[groovy] closure (closure as function parameter | code example)
[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)
JMeter -- distributed pressure measurement
This article is good
Construction d'un Cluster redis sous Windows
2020-10-27
An article takes you to thoroughly understand descriptors