Unity布料系统Cloth

  • Post author:
  • Post category:其他




介绍

布料系统我第一次用是做人物的裙摆自然飘动,当时我用的是UnityChan这个unity官方自带的插件做的裙摆和人物胸部的自然摆动,还有一个插件是Obi Cloth也是用来做布料的。Unity的Cloth也是才看到有这么个组件的,这篇文章我会讲一下Unity官方Cloth的操作,Obi Cloth放到后面来讲一下。



布料系统Cloth(Unity组件)

在这里插入图片描述

创建一个空物体在空物体上添加组件Cloth,Cloth组件会自动给空对象添加Skinned Mesh Renderer

在这里插入图片描述

不显示网格和材质是因为没有添加材质球和网格,选择下图红框基础网格和材质

在这里插入图片描述



组件上的一些属性

bendingStiffness Bending stiffness of the cloth.
弯曲刚度 布料的弯曲刚度
capsuleColliders An array of CapsuleColliders which this Cloth instance should collide with.
胶囊碰撞机 此 Cloth 实例应与其发生碰撞的 CapsuleColliders 数组
clothSolverFrequency Number of cloth solver iterations per second.
布料解算器频率 每秒布料解算器迭代次数
coefficients The cloth skinning coefficients used to set up how the cloth interacts with the skinned mesh.
系数 布料蒙皮系数用于设置布料与蒙皮网格的交互方式
collisionMassScale How much to increase mass of colliding particles.
碰撞质量尺度 碰撞粒子的质量增加多少
damping Damp cloth motion.
阻尼 阻尼值
enableContinuousCollision Enable continuous collision to improve collision stability.
启用连续碰撞 启用连续碰撞以提高碰撞稳定性
enabled Is this cloth enabled?
是否启用 是否启用布料
externalAcceleration A constant, external acceleration applied to the cloth.
外部加速度 施加到布料上的恒定外部加速度
friction The friction of the cloth when colliding with the character.
摩擦 布料与角色碰撞时的摩擦力.
normals The current normals of the cloth object.
法线 布料对象的当前法线
randomAcceleration A random, external acceleration applied to the cloth.
随机加速度 施加到布料上的随机外部加速度
selfCollisionDistance Minimum distance at which two cloth particles repel each other (default: 0.0).
自碰撞距离 两个布料颗粒相互排斥的最小距离(默认值:0.0)
selfCollisionStiffness Self-collision stiffness defines how strong the separating impulse should be for colliding particles.
自碰撞刚度 自碰撞刚度定义了碰撞粒子的分离脉冲的强度
sleepThreshold Cloth’s sleep threshold.
睡眠阈值 布料的睡眠阈值.
sphereColliders An array of ClothSphereColliderPairs which this Cloth instance should collide with.
球体碰撞器 此 Cloth 实例应与之发生碰撞的 ClothSphereColliderPairs 数组.
stiffnessFrequency Sets the stiffness frequency parameter.
刚度频率 设置刚度频率参数
stretchingStiffness Stretching stiffness of the cloth.
拉伸刚度 布料的拉伸刚度
useGravity Should gravity affect the cloth simulation?
使用重力 重力会影响布料模拟吗
useTethers Use Tether Anchors.
使用系绳 使用系绳锚
useVirtualParticles Add one virtual particle per triangle to improve collision stability.
使用虚拟粒子 每个三角形添加一个虚拟粒子以提高碰撞稳定性
vertices The current vertex positions of the cloth object.
顶点 布料对象的当前顶点位置.
worldAccelerationScale How much world-space acceleration of the character will affect cloth vertices.
世界加速度等级 角色的世界空间加速度有多少会影响布料顶点
worldVelocityScale How much world-space movement of the character will affect cloth vertices.
世界速度标度 角色的世界空间运动有多少会影响布料顶点

在这里插入图片描述

翻译

在这里插入图片描述



布料系统的使用

看组件上面有两个按钮,左侧的按钮是用来设置

布料约束

,右侧按钮是设置

布料碰撞


在这里插入图片描述

下图所示的是设置球形碰撞器和Capsule形碰撞器的碰撞对象

在这里插入图片描述



布料约束

这个是布料约束的面板

在这里插入图片描述


Max Distance

: 查看所有节点移动最大距离的窗口

在这里插入图片描述


Surface Penetration

: 查看所有节点穿透性窗口

在这里插入图片描述


Manipulate Backface

: 是反面绘制开关

在这里插入图片描述


Constraint Size

: 绘制的节点的直径大小

在这里插入图片描述



Select面板

可以使用鼠标拖动选中里面的节点,设置节点的

MaxDistance



Surface Penetration



MaxDistance是设置约束点可移动的最大距离 值为0则代表无法移动固定住了

Surface Penetration是设置约束点的穿透性

在这里插入图片描述



Paint面板

Brush Radius代表的是笔刷的半径大小代表你可以拖动鼠标选中节点的多少

在这里插入图片描述

设置好笔刷大小只有点击你要设置的属性MaxDistanc、Surface Penetration和属性的值,点击属性前面的笔刷直接刷节点即可

在这里插入图片描述



Gradient Tool面板


Gradient Start

是梯度渐变的开始值


Gradient End

是梯度渐变的结束值

可以根据你选择的节点设置对应的MaxDistance和Surface Penetration梯度渐变如下图所示

在这里插入图片描述



布料碰撞


Self-Collision

: 自碰撞,防止布料穿透自身


Inter-Collision

: 相互碰撞,允许布料节点相互碰撞


Manipulate Backface

: 是反面绘制开关跟上面的约束是一样的

在这里插入图片描述

要应用自碰撞或相互碰撞,选择要应用碰撞的一组粒子。要选择一组要碰撞的节点,单击“Select”按钮:

在这里插入图片描述

左键单击并拖动以选择要对其应用碰撞的节点

在这里插入图片描述

勾选自碰撞和相互碰撞复选框以将碰撞应用于所选节点
在这里插入图片描述

指定用于碰撞的节点显示为绿色

在这里插入图片描述

自碰撞和相互碰撞可能会占用大量整体仿真时间。考虑保持较小的碰撞距离,并使用自碰撞指数来减少相互碰撞的节点数量。

自碰撞使用顶点,而不是三角形,因此不要指望自碰撞能够完美地适用于三角形比布料厚度大得多的网格。

指定粒子进行互碰撞的方式与指定自碰撞粒子的方式相同。与自碰撞一样,您可以指定一组粒子进行相互碰撞。


要启用碰撞行为,请打开物理设置(从 Unity 的主菜单中:Edit > Project Settings,然后选择Physics 类别),并在布料碰撞部分中将Distance和Stiffness设置为非零值:

在这里插入图片描述



布料碰撞碰撞适用

Cloth 无法简单地与任意世界几何体碰撞,现在只会与Capsule Collider或Sphere Collider阵列中指定的碰撞体进行交互。



版权声明:本文为qq_42194657原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。