预览相关
This commit is contained in:
@@ -20,8 +20,8 @@ namespace NBF
|
||||
bool _cacheTexture;
|
||||
Vector3 _rotating;
|
||||
|
||||
const int RENDER_LAYER = 0;
|
||||
const int HIDDEN_LAYER = 10;
|
||||
const int RENDER_LAYER = 22;
|
||||
const int HIDDEN_LAYER = 0;
|
||||
|
||||
public ModelRenderImage(GGraph holder)
|
||||
{
|
||||
@@ -187,21 +187,16 @@ namespace NBF
|
||||
return uvRect;
|
||||
}
|
||||
|
||||
public GameObject LoadModel(string model)
|
||||
public void SetModel(GameObject model)
|
||||
{
|
||||
this.UnloadModel();
|
||||
|
||||
Object prefab = Resources.Load(model);
|
||||
GameObject go = ((GameObject)Object.Instantiate(prefab));
|
||||
_model = go.transform;
|
||||
_model = model.transform;
|
||||
_model.SetParent(this.modelRoot, false);
|
||||
var h = CalculateModelHeight(go); //计算包围盒高度
|
||||
var h = CalculateModelHeight(model); //计算包围盒高度
|
||||
var pos = _model.localPosition;
|
||||
_model.localPosition = new Vector3(pos.x, pos.y - h * 0.5f, pos.z);
|
||||
|
||||
return go;
|
||||
}
|
||||
|
||||
|
||||
public void UnloadModel()
|
||||
{
|
||||
if (_model != null)
|
||||
|
||||
Reference in New Issue
Block a user