当前位置:网站首页>Unity beginner 5 cameras follow, border control and simple particle control (2 d)
Unity beginner 5 cameras follow, border control and simple particle control (2 d)
2022-07-30 04:29:00 【Lin Fusheng】
This article comes from the notes of teacher chutianbo, link b station
Camera
Don't ask, ask is brainless cinemachine (233, I only know this)
Click on the upper left corner of the window package manager to find the Unity Registry and directly find this plugin in the middle to download
After downloading, we are in HierachyRight-click to create and you can find this cinemachine.
Then directly follow the character you need to follow in Followjust
Camera Boundaries
After setting up, we will find that many of our voids will also come into view.
1. So we add the component Cinemachine Confiner2D to this CM vcm1 (that is, the camera created with cinemachine)
2. Create an empty GameObject and add the component polygon Collider 2D to it, and then pull the green frame to the requiredThe displayed map is the same.
3. Just pull the border into it
Particle Effects
1. Create right-click HierachyEffects particle System
About how to use emm for each button, the official link is given below
Here is a simple explosion effect
InitiallyOriginal material
1. Because it only takes a moment to hit the special effect,And the emitter should be a circle
2. So the time to explode the particle should be 0
3. At the same time no need to repeat
1. Then the first thing we do is to replace the particles, it can be seen that the particles we created at the beginning are white instead of the material we want, 
So find the Texture module and change the mode to sprite to replace the material
2. Set the shape and find the shape module
Change the shape to circle, if it is 3d, it is hemisphere.
Radius is the radius of the circle.
Radius Thickness: The volume ratio of emitted particles.A value of 0 emits particles from the edge of the circle.A value of 1 emits particles from the entire area.Values in between will use a percentage of the area.
Arc is the angle because it needs a circle and that is 360
In fact, I spent a lot of time doing this. In one, I changed the scale, which caused the circle to become a circle perpendicular to the interface. Generally speaking, 2d means that xy is 1.
3.Particle burst time
Find Emission to change Rate over TimeIt is 0, that is, it can explode in an instant
So far, our special effect is done, but one thing to mention is that if our special effect is placed on a moving object and needs to move with the object
We need to change the Simulation Space to World.
The effect is probably like this, the robot goes to the right, the smoke will be realEffect.
Code Control Effects
The example used here is the smoke effect of the robot above, which should be roughly the same
1. Expose particle effects properties
public ParticleSystem smoke;
2. Pull the finished effects into our public properties
(There is actually a bug here, that is, if we use this special effect as a child object of our robot first, then this special effect can only be accessed from under our child objectPull in, but not from our prefab, if it is pulled in from other places, then the code will be changed later)
3. Call in the function
//Choose one of two
smoke.Stop();
//
Destroy(smoke.gameObject);
If there is no error in the difference between these two functions, then the first is to let the particle life cycle end and then disappear, and the secondOne is to disappear directly, no matter how long the particle's life cycle is.
The Duration here is the life cycle
Linkunity official file: particle system
Materials used in this articleFrom unity store Ruby's adventure
linkunity official website
边栏推荐
猜你喜欢

恐造成下一个“千年虫”的闰秒,遭科技巨头们联合抵制
![[MRCTF2020]Hello_ misc](/img/ea/0faacf6e544b60e3459d8ace4d5f42.png)
[MRCTF2020]Hello_ misc

Is the end of the universe a bank?Talk about those things about doing software testing in the bank

Thinkphp 5.0.24变量覆盖漏洞导致RCE分析

@ WebServlet annotations (Servlet annotations)

2.4希尔排序

sql语句-如何以一个表中的数据为条件据查询另一个表中的数据

BGP的简单实验

WEB 渗透之信息收集

Discourse 自定义头部链接(Custom Header Links)
随机推荐
MNIST of Dataset: MNIST (handwritten digital image recognition + ubyte.gz file) data set introduction, download, usage (including data enhancement) detailed guide
山西省第二届网络安全技能大赛(企业组)部分赛题WP(十)
宇宙的尽头是银行?聊聊在银行做软件测试的那些事
cnpm安装步骤
图像视角矫正之透视变换矩阵(单应矩阵)/findHomography 与 getPerspectiveTransformd的区别
1. 获取数据-requests.get()
精品MySQL面试题,备战八月99%必问!过不了面试算我的
labelme的使用技巧
小程序 wx.miniProgram.navigateTo 跳转地址不能是tabbar地址
Reverse Theory Knowledge 3 [UI Modification]
【MySQL系列】-B+树索引和HASH索引有什么区别
[SQL] at a certain correlation with a table of data update another table
BGP的简单实验
2.4希尔排序
Redis【超详解!!!】
MySQL 安装报错的解决方法
Eureka Registry
Based on all volunteers - H and D1 XR806 rare plant monitoring device
Atomic Guarantees of Redis Distributed Locks
Hongji was once again shortlisted in the Gartner 2022 RPA Magic Quadrant and achieved a significant jump in position