I have made a human armature in blender which I’m controlling by python code and the serial data which is aqquired from arduino. The following are my blender-python code and arduino code respectively.
<b>import GameLogic
import time
import serial
from math import radians as r
arm=GameLogic.getCurrentController().owner
arm.channels['Upperarm.Right'].rotation_mode=1
port = serial.Serial('/dev/ttyACM2', 9600)
def upperarm():
global x
x= int(port.readline())
arm.channels['Upperarm.Right'].rotation_euler=[r(x),r(26.639),r(0.576)]
arm.update()</b>
- i’m running the module upperarm in blender with an always sensor.
<b> double x=0;
void setup() {
Serial.begin(9600);
Serial.println("connected");
}
void loop() {
while ( Serial.available()>0)
{x = Serial.parseInt();
Serial.println(x);
Serial.flush();
delay(2000);
x=0;
}
}</b>
MY Problem:
when i input some values in the serial monitor the armature is moving for the first value and then there is no change. I tried for many times but the same is repeating. The human armature is moving only for the first entered value in serial monitor. hoping somebody could help me out.
Thankyou