/// <summary> /// Looks at target. /// </summary> /// <param name="target">Target.</param> public void LookAt(UTransform target) { var dir = target.position - this.position; if (dir.sqrMagnitude < MathHelper.Epsilon) { return; } rotation = UQuaternion.LookRotation(dir.normalized); }
public void setParent(UTransform parent, bool stayWorld = false) { var pos = this.position; var rot = this.rotation; //var scale = this.scale; this._parent = parent; if (stayWorld) { this.position = pos; this.rotation = rot; //this.scale = scale; } }