/// <summary>
/// 滚轮改变物体大小,并刷新Cloth布料系统
/// </summary>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RefreshCloth : MonoBehaviour {
float Size= 1.0f;//物体大小
float Change = 1.0f;//滚轮变量
float Last = 1.0f;//上一次滚轮变量
public GameObject FatheBody;//父物体坑位
public GameObject Cloth;//带有布料系统的坑位
void Update()
{
h = Input.GetAxis("Mouse ScrollWheel");//获取滚轮变量
Size += Change; //累加滚轮变量得到左后的物体大小
FatheBody.transform.localScale = new Vector3(1 * Size, 1* Size, 1 * Size);//改变父物体的大小
if (Last - Change != 0)//判断滚轮是否有改变,更新Cloth
{
Cloth.GetComponent<Cloth>().enabled = false;
Cloth.GetComponent<Cloth>().enabled = true;
Last = Change;
}
}
}
滚轮改变物体大小,并刷新cloth
项目里发现缩放物体时布料系统并不会跟着一起缩放,找了好久,没找到根本的办法~只能曲线救国了~靠刷新解决