# Rotation/Transform Locked Objects With Leap Motion

Hi All,

I want to use the leap motion to open/close doors and open/close drawers. Is it possible to use the leap motion to interact and grab a specific area (like a door handle) and swing it open, but locked into the only rotation a door would open, and then stop where it should.

The same rules for sliding open a drawer, then sliding it back into place. Basically, is there a way to set the limits of where an object can be moved, transform and rotation.

I suppose this info would be helpful even without the leap motion, but if you have any info that would really help.

THX

You can use physics constaints or vector mask, if you use scripts to move object.
Physics constraints are pretty obvious, so I’ll explain another approach.
For example, you have to script a drawer. After asigning current shift (float), you can multiply it by vector mask and pass result to AddRelativeLocation. Vector mask is basically normalized vector with value == 0 on locked axis and value > 0 on unlocked axis. For example, (0,0,1) would move only up and down relatively.

Hey KelbornKad, thanks for the response, I’ve been trying to implement your method but at the moment I’m struggling somewhat. I’m not great with blueprints, so please bear with me.

I basically have a player pawn, that has a cube attached to it acting as a “hand” - that calls a class event when my “hand” object comes in contact with the “drawer” collision. I also have a vector variable tracking the world location of my “hand” object and plugged that into a pin for the class event.

Then in the “drawer” blueprint, I have the class event that will respond to the “hands” movement, in this case, I want to move only the X location, nothing else. However, here is where I’m stuck. If I plug the X location from the vector variable (from the hands location) into the “AddRelativeLocation” the draw just flies off into 3d space, not sure what I’m doing wrong?