mix 2d and 3d done

This commit is contained in:
2015-08-16 20:58:37 +06:00
parent 3a0d4e3b2f
commit b52c52870f
12 changed files with 1610 additions and 762 deletions

View File

@@ -361,30 +361,6 @@ namespace IsoTools {
: obj.AddComponent<T>();
}
static Bounds IsoObject3DBounds(GameObject obj, bool exist, Bounds bounds) {
var renderer = obj.GetComponent<Renderer>();
if ( renderer ) {
if ( exist ) {
bounds.Encapsulate(renderer.bounds);
} else {
exist = true;
bounds = renderer.bounds;
}
}
var obj_transform = obj.transform;
for ( var i = 0; i < obj_transform.childCount; ++i ) {
var child_obj = obj_transform.GetChild(i).gameObject;
bounds = IsoObject3DBounds(child_obj, exist, bounds);
}
return bounds;
}
public static Bounds IsoObject3DBounds(IsoObject iso_object) {
return iso_object
? IsoObject3DBounds(iso_object.gameObject, false, new Bounds())
: new Bounds();
}
public static IsoCollider IsoConvertCollider(Collider collider) {
var fake_collider = collider ? collider.GetComponent<IsoFakeCollider>() : null;
return fake_collider ? fake_collider.isoCollider : null;