I have just started using the game engine, so please excuse me if I’ve missed something fundamental
I have a script running that controls a cube. I’m reading a few values (over UDP) and sets cube position and rotation according to these values. This works perfectly in Blender, but when I export - nothing moves whatsoever. There is a message quickly flashed before the exe runs, saying:
Color management: using fallback mode for management
BLF_lang_init: ‘locale’ data path for translations not found, continuing.
I have tried Blender 2.72, 2.73 and 2.74. I have also tried separately installing Python. Nothing works so far.
This is the script I am running:
import bpy, bge, socket, struct, math
def main():
# Setup objects
cont = bge.logic.getCurrentController()
player = cont.owner
if not 'init' in player:
player['init'] = 1
# open network socket
port = 20001
player['socket'] = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
player['socket'].bind(("127.0.0.1", port))
print("Run
")
player['socket'].settimeout(.04) # Caught in exception to not lock program
schene = bge.logic.getCurrentScene
try:
data, addr = player['socket'].recvfrom(16) # 'bufsize' bytes
if data:
unp = struct.unpack('!2d', data)
player.localPosition.z = unp[1]
player.localOrientation = (0, 0, unp[0])
else:
print('no data')
except socket.timeout:
print('')
main()