The best darn throwable object spinner

Nothing more I can say about this release other than its a draggable object rotator that supports extremely responsive throw mechanics. Plop it on an object (don’t forget a collider to allow touch interaction), touch and drag on the model on your mobile device to rotate the model around and flick your finger to send it spinning with extremely natural velocity.

Don’t forget to set your frame rate to 60 FPS with Application.targetFrameRate = 60 to ensure silky smooth response.

This solution has an expectation barrier in that rotation is based on the object’s x and y axis and not camera/screen space. If I develop a clearer approach I’ll release an update but the solution provided should be a great jumping off point for the problem it solves.



  1. jamdaar
    March 21, 2012

    how would this script be modified to work with mouse instead

    • March 21, 2012

      Hmmm… maybe I’ll add the option in for this to work on desktop as well but as it stands it would take a little tweaking to get it working.

  2. daanMuller
    March 21, 2012

    I cannot get this to work at all on 1st gen iPad. I made a cube, it has the cube collider, through this script on it — nothing. XCode actually shows an error too (I think during the ray cast). The Coroutines don’t really seem to be responding either.

    • March 29, 2012

      Can you get me the exact error? Please make sure you have a camera in your scene that is tagged as “MainCamera” as well.

  3. DBK
    March 22, 2012

    Anyone having probs with this throwing an XCode error and not working? Unity 3.5 Pro, Unity iOS basic, XCode 4.3, iPad 1st Gen.

    • March 29, 2012

      Can you get me the exact error? Please make sure you have a camera in your scene that is tagged as “MainCamera” as well.

  4. Iguana_02
    January 21, 2013

    Hi and thanks for this fantastic plug in!
    I’m planning to use it on a new AR App i’m developing and it works very nicely, i got one problem that i can’t find how to solve it.

    EDITOR: if i click and drag the object using unity Remote, the object spins few frames and then i got an error
    (IndexOutOfRangeException: Array index is out of range)
    (DraggableObjectSpinner c__iterator4.MoveNext()at……

    The same thing happens very randomly running on a device causing a crash (and Xcode log reports the same error).

    Do you know how to solve it.


    • Iguana_02
      January 21, 2013

      SOLVED! Just need to replace this code:

      IEnumerator DragRotation(){
      StopCoroutine( “FreeSpin” );
      bool running = true;

      while ( running ) {

      if (Input.touchCount > 0)
      Touch activeTouch = Input.touches[ fingerID ];

      if ( activeTouch.phase == TouchPhase.Ended || activeTouch.phase == TouchPhase.Canceled ) {
      running = false;

      transform.Rotate( new Vector3( activeTouch.deltaPosition.y * dragMultiplier.x, activeTouch.deltaPosition.x * (dragMultiplier.y*-1), 0 ), Space.World );

      velocity.y = ( ( previousTouchPosition.x – activeTouch.position.x ) * velocityMultiplier );
      velocity.x = ( ( previousTouchPosition.y – activeTouch.position.y ) * velocityMultiplier );
      previousTouchPosition = activeTouch.position;

      yield return null;
      else {
      running = false;