Search Unity

Leap Motion Restricting Movement Axis for Selected

Discussion in 'Scripting' started by pajamajama, Jul 10, 2013.

  1. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Hello,
    thank you in advance for any help you may offer.

    I am pretty new to scripting and I'm hoping this is an easy fix for anyone out there with experience. I'm using the LeapMotion SDK Unity Sandbox example, and I would like to restrict the selected objects movement along only the x and y axis. I found this method inside the LeapUnitySelectionController Script:

    DoMovement

    Thank you very much,
    Kevin
     
    Last edited: Jul 10, 2013
  2. Patico

    Patico

    Joined:
    May 21, 2013
    Posts:
    886
    If you add a Rigidbody Component (Component/Phisics/Rigidbody) to your GameObject, it will give you possibility to restrict object's movements along any axis.
     
  3. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Thanks! That wasn't working with the physics I was using. I was able to fix this by resetting the z axis to 0 every frame in the update function.