mcjTcpBridge

https://www.youtube.com/edit?video_id=whDXyvpB-9A

History

Sep 7, 2016, 1:28AM MCJTELEMETRYCLIENT.ZIP for DS1, DS2, DS3, DS4 ( not tested on DS2, DS3 )

SEP 6, 2016, 3:01 AM MCJTCPSERVER.ZIP

SEP 6, 2016, 3:07 AM MCJTELEMETRY.HTML

SEP 6, 2016, 9:25 PM MCJTOUCH.HTML

How To Get Your PC's LAN IP Address

We want your phone or tablet to communicate with your PC

In order for this to work, your phone itself must be allowed to be on the house's LAN

If your phone uses the home router to browse the internet

and the PC uses the same router that's a good start!

We need the IP address of your PC on the LAN

1.On Windows 10 click on the Start button

2. Type cmd in the 'Ask Me anything' box and hit Enter

1. On Older Windows From the "Start Menu" click "Run"

2 Type cmd and hit "OK" to open Command Prompt.

3. type the word ipconfig

4. press Enter

the precious number we wanted is at the and of the line starting with the word ipv4

in the case of my PC, the LAN IP is 192.168.100.103

A Web Page That Reads Your Phone's sensors

The element of this system that "runs" on your phone is a simple web page with some javascript code behind the curtain.

This web page can be found below in the Attachments section under the name "MCJTELEMETRY.HTML"

if you click on the little down-pointing blue arrow the file will be downloaded on your PC or Phone or Tablet

If you download it on your PC you'll have to find a way to transfer it to your phone, for example, by emailing it to yourself.

On my phone, i allowed mcjTelemetry.html be downloaded, i then accepted to open the file on my phone's Chrome browser

ant there it is, very alive !

IMPORTANT : In the field titled "Server IP" you must type the IP Address of your PC. We obtained it in the previous section ! Mine is 192.168.100.103 so i typed 192.168.100.103:9002

The Number 9002 is like an apartment number. The server will be waiting for us at 9002

so it's very important to type the Server IP this way and not forget the colon :

A Web Page That Reads Your Phone's Touch Screen

As you saw above, the element of this system that "runs" on your phone is a simple web page with some javascript code behind the curtain.

This web page can be found below in the Attachments section under the name "MCJTOUCH.HTML"

if you click on the little down-pointing blue arrow the file will be downloaded on your PC or Phone or Tablet

If you download it on your PC you'll have to find a way to transfer it to your phone, for example, by emailing it to yourself.

On my phone, i allowed mcjTOUCH.html be downloaded, i then accepted to open the file on my phone's Chrome browser

As you can see this page will be tracking up to 4 finger touches in the grid area.

The position of the touch will be relayed to Daz Studio as an x,y coordinate ranging between -1,-1 and 1,1

it will also be returned as an angle in degrees ( -180 to 180 ) plus a radius ranging between 0 and 1

So you'll be able to use your touches to rotate a camera or a head !

A WebSockets 'print server' on your PC

The server app named mcjTCPServer.exe will receive the data from the phone and optionally relay it to Daz Studio. Like any program, you must trust the source of that program, or at least trust your anti-virus to catch the bad ones ! Your browser and your PC will very probably warn you and make it a bit difficult to download. For this reason i packaged it in a zip file. A good location for mcjTCPServer.exe would be your C:\Program Files (x86)\mcasual folder. But you may have to settle for C:\users\YourUserName

This websocket server is, in fact, a very barebones websocket server, it's based on the example program "print server" and is part of Zaphoyd's websockpp library ( Open Source BSD ). it simply "prints" on the console/screen whatever it receives on port 9002. So Mac or Linux programmers could simply compile the same example program and get a PC/Linux server that suits our needs!

Zaphoyd's websockpp library ---> https://www.zaphoyd.com/websocketpp

Testing the Phone-to-PC link

Run mcjTCPServer.exe by double-left-clicking on it using Windows Explorer.

nothing happens, The server is waiting for someone to call 192.168.100.103:9002

On your phone you did type something like 192.168.100.103:9002 didnt you? If you did not, it may mean you skipped reading the previous section of the manual, and well we can't do nothin' for you !

Click on the mcjTelemetry.html's Connect button

The Phone and the PC exchanged greetings !

near the top of mcjTelemetry.html you can see a drop-down list

presently the data rate is set very slow, 1 sample per second

but you could increase this up to 30 samples per second.

So when we'll click the Play button, the phone will send the 9 measurements you see on your phone's screen to mcjTCPServer.exe on your PC.

Lets do just that , click the Play button, let it run a few seconds, press the button again ( now named Stop! )

the Server received all that data !

Note that the data stream started by stating what labels to use for the 9 columns of data

And now lets get that data to Daz Studio !

Installing mcjTelemetryClient in Daz Studio

The mcjTelemetryClient is a script for Daz Studio. ( like a program running inside Daz Studio )

The zip package is found at the bottom of this page

unzip it in a Daz Studio content folder,

typically

C:\Users\YOURUSERNAME\Documents\DAZ 3D\Studio\My Library

or

C:\Program Files\DAZ\Studio\content\

or

C:\Program Files (x86)\DAZ\Studio\content\

once installed, it will appear in your Daz Studio content library

My Library\ / Scripts / mcasual

or

Studio / Scripts / mcasual

Installing mcjTelemetryClient in Daz Studio

Select the nodes you want to animate using your phone/tablet

Launch mcjTelemetryClient which should be in your scripts/mcasual content folder

The "Client Channels" list now contains the list of parameters and morphs for the nodes you selected in the scene

As you can see here i selected a prop named mcjTheremin before launching the script

  • Click on the Server Path button and browse up to mcjTcpServer.exe ( we explained this ).
  • Click on the Start Server button.

If all went well, mcjTcpServer.exe in now running ( though it's invisible )

mcjTcpServer is patiently waiting for someone to initiate a communication over the LAN/WiFi on port 9002

On your phone you should have in your browser either McjTouch.html or McjTelemetry.html

Touch the the "Connect" button on the phone's web page

As you can see the connection here was a success, the "Connect" button is now a "Disconnect" button

Transmission of the data will only begin when you use the "Send" or the "Play" button

If the connection was established, the list on the left of mcjTelemetryClient will

fill up with the names of the data items provided by the phone's web page.

The phone sent us this information, one more proof that the communication channel is established.

Select a Server Channel example, the server channel named

, select a Client channel, type in values for "Mult" and "Add" use the "Add Link" button

here you can see i connected

the x coordinate of the first finger position of the phone's touch screen

to

the X Translate parameter of the Theremin prop.

The touch screen positions range between -1 and 1

so i specified i want to multiply this by 100 and i want to add 0

So when i touch the left side of the phone screen, the theremin will move 1 meter to the left,

when i touch the right side of the screen the theremin prop will float 1 meter to the right.

Click on the The "Play" button on the phone's web page

touch the phone's touch screen

the theremin now moves !

by default the sampling rate is very low, 1 time per second

change it to, say, 10 samples per second

if you press the record button, the Daz Studio timeline cursor will start advancing, since your phone controls

the prop's position, you are effectively doing motion capture!

Final Notes: mostly in the case of figures the motion capture is not very somooth, eventually i'll return to this script and try to improve it. In the meantime, a clever use on mcjMakeTarget and mcjParent could help you. You could capture the motion using a null node, then transfer the motion using mcjParent.

License for mcjTelemetry.html, mcjTouch.html and mcjTelemetryClient.dsa

// =====================================================================

// by mCasual/Jacques

// You can use this script freely for personal or commercial use.

// You may not sell, resell, sub-license or rent this script in any way.

// you may credit this script to mCasual/Jacques

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES

// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT

// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,

// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

// OTHER DEALINGS IN THE SOFTWARE.

// =====================================================================