//reference for drag and drop: https://www.youtube.com/watch?v=0yHBDZHLRbQ private void OnMouseDown() { //Debug.Log("mouse down: " + this.name); if (CanDragDisk()) { diskCollider.isTrigger = true; mouseZCoord = Camera.main.WorldToScreenPoint(transform.position).z; mouseOffset = transform.position - GetMouseWorldPos(); diskPositionBeforeMouseClick = transform.position; isBeingDragged = true; previousRod = currentRod; } }
private void OnTriggerEnter(Collider other) { if (isRod(other.gameObject)) { GameObject rodGameObj = other.gameObject; RodController rodController = rodGameObj.GetComponent <RodController>(); if (rodController.CanAddDisk(this)) { rodController.AddDiskToRodStack(this); currentRod = rodController; isOnRod = true; } } }