I have a problem about Blender with P5 Glove

Now I try to connect to blender with P5 Glove through ctypes Module and running of Carl Kenner P5dll.dll Library, but I have a problem is the cyclic of Python Script, it must be called P5_Init () Function, which it cyclic very slowly. It makes reading the position X, Y, Z, and then apply the Function setPosition slowly and where there are discrepancies. I do not want use cyclic P5_Init () Function of the Script.

Example Code.

"import GameLogic
from ctypes import *

controller = GameLogic.getCurrentController()
scene = GameLogic.getCurrentScene()
objList = scene.objects
model = objList[‘OBCube’]

libc = windll.p5dll

libc.P5_Init()

P5_Init () makes this very slow Script Model is not a Realtime motion, because it is where included in the setPosition device has moved to another location, but the value back to the previous location.

number_g = libc.P5_GetCount()

x = c_float()
y = c_float()
z = c_float()

data_p = libc.P5_GetAbsolutePos(c_int(0), byref(x), byref(y), byref(z))

model.setPosition([(x.value),(y.value),(z.value)])
actMove = controller.actuators[“act”]
cont.activate(actMove)"

Understand that I am describing? I know little English.

How to resolve this problem for me. please

Hi,

normaly you schould call a init function only one time not cyclic. So try to call it only on startup of the progam. There are to ways to do this. You can make a separate init script where you can call the libc.P5_Init(). Conect an alwayssensor with the python script call function. Or you can avoid multible calls with a IF statement.

init1 = 0
if init1 == 0:
init1 = 1
libc.P5_Init()

Dont forget to call the libc.P5_Close() on program termination to avoid memory leaks.

HG1

Hi, HG1

Thank a lot

za_phu