unity测量模型尺寸
unity测量模型尺寸3Dmax模型导出为FBX的注意点脚本实现方法3Dmax模型导出为FBX的注意点3ds Max中的比例因子参数就是对应了Unity的Transform中的【Scale】属性。而场景单位就是对应于Unity中的单位,为与Unity单位一致,场景单位最好设置为【米】。将模型导入到Unity之后要注意观察其【Convert Units】选项,通常情况下,为了保证3ds Max与Un
·
unity测量模型尺寸
3Dmax模型导出为FBX的注意点
3ds Max中的比例因子参数就是对应了Unity的Transform中的【Scale】属性。而场景单位就是对应于Unity中的单位,为与Unity单位一致,场景单位最好设置为【米】。将模型导入到Unity之后要注意观察其【Convert Units】选项,通常情况下,为了保证3ds Max与Unity中的模型尺寸一致,需要将该选项选中。
https://blog.csdn.net/fenggewan/article/details/103622248///
脚本实现方法
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class size_checker : MonoBehaviour
{
void Start()
{
//方法1:
//Renderer.bounds.size
//https://blog.csdn.net/linxinfa/article/details/107532897
//这个值的结果真实反应出有MeshRenderer这个组件的模型的尺寸
var size1 = transform.GetComponent<Renderer>().bounds.size;
Debug.Log("测量方法1:"+"x: " + size1.x + ",y: " + size1.y + "为显示尺寸");
//方法2:
//MeshFilter.mesh.bounds.size
//通过MeshFilter获得原始模型的mesh,该值返回的结果是原始mesh的尺寸。
var size2 = transform.GetComponent<MeshFilter>().mesh.bounds.size;
Debug.Log("测量方法2"+"x: " + size2.x + ",y: " + size2.y + "为模型尺寸");
}
void Update()
{
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)