public void Animate() { _bounds = ForgeImport.GameObjectBounds(_root); _rotationActivated = true; //if ( _rotationCoR != null ) // return ; //_rotationCoR =StartCoroutine (RotateObject.Instance.Rotation (_root.transform, new Vector3 (0f, 180f, 0f), 5f)) ; ////_rotationCoR =StartCoroutine (RotateObject.Instance.Rotation (_root.transform, new Vector3 (0f, 0f, 0f), 5f)) ; }
protected void OnDrawGizmosSelected() { //if ( GetComponent<MeshFilter> () == null ) // return ; //Bounds b =GetComponent<MeshFilter> ().sharedMesh.bounds ; //Gizmos.color =_color ; //Gizmos.DrawWireCube (transform.position + b.center, 2 * b.extents) ; Bounds b = ForgeImport.GameObjectBounds(this.gameObject); Gizmos.color = _color; Gizmos.DrawWireCube(b.center, 2 * b.extents); }
public IEnumerator Scale(Transform thisTransform, Vector3 startScale, Vector3 endScale, float value, ScaleObject.ScaleType moveType) { float rate = (moveType == ScaleObject.ScaleType.Time) ? 1.0f / value : 1.0f / Vector3.Distance(startScale, endScale) * value; float t = 0.0f; while (t < 1.0) { t += Time.deltaTime * rate; thisTransform.localScale = Vector3.Lerp(startScale, endScale, Mathf.SmoothStep(0.0f, 1.0f, t)); Bounds bounds = ForgeImport.GameObjectBounds(thisTransform.gameObject); thisTransform.position += (_bounds.center - bounds.center); yield return(null); } }
public void Floor() { Bounds bounds = ForgeImport.GameObjectBounds(_root); Vector3 bottom = bounds.center - new Vector3(0f, bounds.size.y / 2f, 0f); float offset = -1.5f - bottom.y; _root.transform.localPosition += new Vector3(0f, offset, 0f); //_root.transform.localPosition =new Vector3 (0f, -1.5f, 0f) // + new Vector3 (0f, bounds.extents.y, 0f) ; //_root.transform.localPosition +=new Vector3 ( // 0f, // _root.transform.localPosition.y - 1.5f + bounds.extents.y, // 0f //) ; }
public IEnumerator Scale(Transform thisTransform, float byThatMuch, float value, ScaleObject.ScaleType moveType) { _bounds = ForgeImport.GameObjectBounds(thisTransform.gameObject); yield return(Scale(thisTransform, thisTransform.localScale, thisTransform.localScale * byThatMuch, value, moveType)); }