Fix collision layers

This commit is contained in:
2016-03-29 02:40:57 +06:00
parent bdc20eea4b
commit fccf22b3cd

View File

@@ -16,7 +16,19 @@ namespace IsoTools.Internal {
get { return _isoObject; }
}
void FixLayers() {
var iso_object_layer = isoObject.gameObject.layer;
if ( gameObject.layer != iso_object_layer ) {
gameObject.layer = iso_object_layer;
for ( int i = 0, e = transform.childCount; i < e; ++i ) {
var child = transform.GetChild(i);
child.gameObject.layer = iso_object_layer;
}
}
}
void FixedUpdate() {
FixLayers();
if ( !IsoUtils.Vec3Approximately(_lastPosition, isoObject.position) ) {
_lastPosition = transform.position = isoObject.position;
} else if ( !IsoUtils.Vec3Approximately(_lastPosition, transform.position) ) {