Motion Controller Pitch Range

I’m currently trying to use a Vive Motion Controller to emulate flightstick style controls. I’m trying to get them to work as follows:

With the controllers held straight upwards, the pitch should be 0 and when tilted forwards or backwards the pitch should be between 1 and -1.

My problem is that the values returned from GetWorldRotation or GetHandPositionAndOrientation go from 0 (controller tilted forward 90 degrees) to 90 (controller facing upwards) back to 0 (controller tilted backwards 90 degrees).

How would I go about getting a full 180 degree range of values from the controller?

What I would do is define a direction as up. Either by using an invisible arrow component or something, or simply defining a vector in code. Then I use the dot product between the stick forward vector and the base position vector. By doing so you can get a full range of values from 180 to -180.


Thanks for the help! Doing what you suggested didn’t give me what I wanted exactly but it put me on the right track. I’m using the controller forward vector and getting a value between 1 and -1 which seems to do the trick.

how did you get it to work ?

NooobsdeSroobs, what does dot product mean? You mean multiply? You are multiplying the “stick forward vector” and the base position vector? What do you mean by stick forward vector? Are you referring to the invisible arrow? What do you mean by the base position vector? The base position of the motion controller? How do you get the base position of the motion controller? Thank you for your time.

hi , what did you do exactly? Using controller forward vector I get a value between 1 and -1, but it still restarts when I point the motioncontroller to the sky once I get to 1. I still don’t have a full 180 degree range of values above the horizontal plane.

I can’t control how you respond. If you think I’m not worthy of a more useful response, what can I do? However, I think it’s appropriate for me to let you and others know your answer isn’t terribly helpful. It’s just as appropriate as your lazy response, which I totally accept. It’s your right. But we don’t all come to the table with the same knowledge. And, I wouldn’t be asking the questions if I wasn’t interested in learning. Are you an expert on every single thing related to UE4? Have you ever needed to ask other people for help? I am weeks away from bring to market two apps, and yes, I am hurt by your response a little bit, especially after all the work I’ve done.

To let them know YOU did not find it to be terribly helpful. The guy who asked understood it. Anyways, you are free to vote it down if you found it unsatisfactory, but I find it interesting that you started finding it unsatisfactory after I refused to give you a detailed response. And to address your efforts towards learning: Yes, you might be willing to learn, but you showed signs of not really wanting to do any effort towards learning. If I used a really difficult English word, for example xentorp you would not know what it meant, but you could and hopefully would google it. Then why did you not google dot product? Because you were too lazy? You didnt think of it because you are used to getting your answers handed to you? The basic required knowledge is required and if you dont have it then come back once you have obtained it.

Did you notice he took a different approach. I wonder why?

And some of my questions to you were trying to get more clarity in order to research more. Stick forward vector is not a term common to vector math is it? I assume you’re talking about the arrow, but I wasn’t sure.

I don’t want to fight you. I don’t care about this conflict over which questions are appropriate to ask and which answers are appropriate to give. I only care about finishing my product.

What if I paid you? How much would you charge to solve this specific problem?

I noticed that he used a modified version of my approach. I dont wonder why.

I up-voted your answer. You’re right. I think I should not have down-voted it. What you had to say was more helpful than not saying anything, even if I feel it could have been more detailed and specific to UE4; and I’ll be totally honest, I was a little hurt by what you implied in your response. I’ve put in a lot of work, and by hook or by crook, managed to make something interesting that I want to share with others. I am not interested in fighting you. I only want to solve my problem and bring my app to market. When you feel like providing a little more detail I’d be happy to read what you have to say. If you don’t think I deserve a response I accept that as well. It’s perfectly acceptable for you to not respond with any kind of practical or substantive answer. Thank you for your time. If any Epic staff are reading this, yes, I still need help and would appreciate a more detailed response at some point in the future. And if you want to earn some money I would seriously consider paying you to help me solve this problem.

I am happy to help you, but the two things you asked about: What is a dot product? and What do you mean about a stick? Could easily have been answered by reading the question and doing a google search. A dot product is so well explained other places. Once you do, come back and ask if you still dont understand something. You should only have one or two questions then. I will delete my comments from this “fight” and I will be looking forward to your future question. Good luck.

Thank you.

Also, this brief video tutorial on dot product helped me understand things a little better:

It combined a presentation of the concept with a short guide on how to practically implement it within UE4 blueprints.

Dot product