Download

Compare Motion Controller position on button press to current position while pressed.

I would like to compare my right-touch controller with it’self, overtime, in local space.

I would like to do is on button press get a local transform, then while pressed compare the original local position to it’s current position, and use the horizontal distance to create a float that drives the yaw of the scene rotation.

I can’t use “get distance to” because that references actors not components… Basically is there no easy way to get the distance between components? I don’t know what is missing from logic. Also, how do you smoothly rotate the scene over time?

You need to create a Boolean variable, bButtonPressed, which is set to true when the button is pressed and set back to false when the button is released.
Then you need one Vector variable, vLastPosition, to store the last position of the motion controller.
In your Event Tick, Branch on bButtonPressed. If True, get the current position of the controller, subtract from it the vLastPosition (i.e. current position - last position). The length of the resulting vector is the displacement of the controller over the last frame which you can use to do whatever you need to. Finally assign the current position to vLastPosition.

A more sophisticated implementation uses a LIFO N-dimensional array of positions and averages the displacement over the last N frame. This helps to smooth out the output.

Give it a try and ask again if you can’t get it to work.

Cheers,
Marco.