HTC Vive - Measuring The Distance Between The Two Controllers

HTC Vive - Measuring The Distance Between The Two Controllers

Anonymous
Not applicable
948 Views
4 Replies
Message 1 of 5

HTC Vive - Measuring The Distance Between The Two Controllers

Anonymous
Not applicable

Hi guys,

 

I'm looking into building in some functionality similar to Live Design into one of my projects, where you can pick up an object and scale it by pulling your controllers apart. 

 

I'm assuming this is based on some calculation of the distance between the two hand controllers tied to the scale of the object. 

 

How can i set this up in flow? I just need a way to get a numeric variable that is the distance, i think i can handle converting that to a scale factor. 

 

I'm seeing some possibilities with the 'length' node, but i'm not sure how to get the vector that plugs into that.

 

Any advice would be greatly appreciated! 

Reply
Reply
0 Likes
Accepted solutions (1)
949 Views
4 Replies
Replies (4)
Message 2 of 5

paul.kind
Alumni
Alumni

The easiest way to accomplish this is to use the distance function from lua.  Unfortunately there isn't a flow node for this.  It can be easily created however.

http://help.autodesk.com/view/Stingray/ENU/?guid=__lua_ref_obj_stingray_Vector3_html

 

Once you have the distance, simply plug in the vector location of your controllers.

I will give you the required code in a few minutes, just need to write the flow node myself.  Once complete ill post a followup with the function calls and the flow node.

 

Paul

 

 

 

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply
0 Likes
Message 3 of 5

paul.kind
Alumni
Alumni
Accepted solution

Ok, Got it.

 

Here is what you need to do.

1. Download the package attached. Unzip.

2. Put the 2 script files in the following locations in your project.

-- math_nodes.lua --->> scripts/lua/

-- math_nodes.global_script_flow_nodes -->> scripts/

3. In the scripts/lua file, find project.lua and open it.

4. add the following line directly below require 'script/lua/flow_callbacks' found on the top of the file.

require 'script/lua/math_nodes'

5. Save the script file.  

 

In your flow you should now find a new category called "custom scripts" and within it you will find your distance node.  It looks something like this.

distance.PNG

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply
Message 4 of 5

Anonymous
Not applicable

Paul this is fantastic, thank you so much for taking the time to write this for me. I'm yet to try it out but it looks exactly what i'm after. Brilliant!

 

It's also given me an insight into possibly using other lua functions like this in custom flow nodes and how to do it!

Reply
Reply
0 Likes
Message 5 of 5

paul.kind
Alumni
Alumni

Fantastic, lemme know if you need any help!

 

Also, please mark as solved if it worked out for you.  Helps us a lot here on our side.  Otherwise we have open issues and it slows us from helping non-solved issues.

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply
0 Likes