Intro..
This script was inspired by John Rand's work: CSV 2 Keys and has some borrowed code from Bobo.
Just drag and drop the script to 3dsmax and you will find in the "3idee tools"-category.
Here you can download the script. It gets the pointdata and put it into the animated position keys of a point-helper.
Setting up and running Accelerometer..
Download and install the app on your Android phone. Now run the app and go to settings. Change the following settings:
- Remove Earth Gravity = on
- Sensor speed Slowest. Try this speed first, it works very well with handheld movements.
- Set the File name
The higher the speed, the more jitter you will get in the movements.
Now go and save the movements. What I do is just email the resulting TXT file to myself.
Now open the TXT file in Wordpad and remove all the lines that do not contain 4 values. That is the first 5 lines and the last 2 lines.
Save the file.
Running the maxscript..
Drag and drop the acc_app_reader.ms to 3dsmax. Now go to Customize user interface, and find the category "3idee tools". Drag the script to a toolbar and press it!
The following floater will appear:
There are 6 import speeds:
- Real values will take the exact values from the forth column of the TXT file. As you can see in the previous image those values vary a bit. (217,210,209,219,211,210)
- Fastest through slowest puts the keys at exactly 10,30,70 and 210ms apart.
- Keyframed will ignore any in between time and just puts every position exactly on a keyframe.
Real values through Slowest will result in keys being positioned in between timeframes. You can however collapse the movement in the motion tab with a certain sample range in 3dsmax.
The scale value will scale all the values in the TXT file.
Press the "Do it!!" button and select your modified TXT file. After import just attach any stuff to the point-helper to get some fun results. (particles, cloth and so on....)
The script will change the animation range automatically.
Hope you have fun with it!!



Hi Michiel, I get an error when I want to use your script. I'm using Max2015 and here is a line of the captured data:
ReplyDelete-0.76 0.111 0.603 71
-0.408 0.307 -0.146 69
-0.264 0.138 -0.373 70
-0.168 0.262 -0.301 70
0.192 0.167 0.004 71
--Unable to convert: undefined to type: float.
line 49 of the script is highlighted in the max listener. line 49: global trash = gr[4] as float
I cleaned the txt, do you know what this could be?
thnx you in advance.
Ron
Problem fixed. Opened the file with wordpad to remove the extra lines and now it does work. I guess notepad messed up the lines or something.
ReplyDelete