当前位置:网站首页>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
边栏推荐
- 2.4希尔排序
- Pytorch框架学习记录2——TensorBoard的使用
- 2022.7.29-----leetcode.593
- SQL Server data type conversion function cast () and convert () explanation
- 网页元素解析a标签
- golang中如何比较struct,slice,map是否相等以及几种对比方法的区别
- C. Travelling Salesman and Special Numbers (二进制 + 组合数)
- Atomic Guarantees of Redis Distributed Locks
- Pytorch framework learning record 4 - the use of datasets (torchvision.dataset)
- What are Redis server startup after the operation?
猜你喜欢
Usage of exists in sql
恐造成下一个“千年虫”的闰秒,遭科技巨头们联合抵制
商品管理系统数据库设计--SQL Server
VUX Datetime 组件compute-days-function动态设置日期列表
MySQL 字符串拼接 - 多种字符串拼接实战案例
state space representation
swagger usage tutorial - quick use of swagger
DAY17:弱口令的探测与测试
The leap second that may cause the next "Millennium Bug" is boycotted by tech giants
labelme的使用技巧
随机推荐
Pytorch框架学习记录6——torch.nn.Module和torch.nn.functional.conv2d的使用
MySQL operation statement Daquan (detailed)
弘玑再度入围Gartner 2022 RPA魔力象限并实现位置大幅跃升
The underlying mechanism of the function
MySQL 安装报错的解决方法
Eureka注册中心
C. Qualification Rounds(思维,特情)
BGP的简单实验
MySQL 操作语句大全(详细)
golang中如何比较struct,slice,map是否相等以及几种对比方法的区别
Shell script basic editing specifications and variables
Android Studio implements login registration - source code (connecting to MySql database)
深圳见!云原生加速应用构建专场:来看云原生 FinOps、SRE、高性能计算场景最佳实践
What are Redis server startup after the operation?
Install MySQL Database on Kylin V10 Operating System
The leap second that may cause the next "Millennium Bug" is boycotted by tech giants
[SQL] at a certain correlation with a table of data update another table
sql语句-如何以一个表中的数据为条件据查询另一个表中的数据
Pytorch框架学习记录3——Transform的使用
LeetCode 114. Expand Binary Tree into Linked List (One Question Three Eats)