ошибка блендера-питона - PullRequest
1 голос
/ 30 мая 2011

я получаю эту ошибку:

Traceback (последний вызов был последним):
Файл "движение", строка 1, в (модуле) NameError: имя 'GameLogic' не определено

import GameLogic

cont = GameLogic.getCurrentController()

fwd = cont.sensors['forword']
bck = cont.sensors['backword']
lft = cont.sensors['left']
rit = cont .sensors['right']

move = cont.actuators['move']

speed = [0, 0, 0]
rot = [0, 0, 0]


if fwd.positive:

# speed[0] 0 mean the movement will be according tot he x axis 
# speed[1] 1 mean according to the y axis and 2 for z axis

   speed[0] = 0.7

elif bck.positive:
    speed[0] = -0.7


if lft.positive:
    rot[0] = 0.1

elif rit.positive:
    rot[0] = -0.1


move.uselocalDloc = true
move.uselocDrot = false

move.dloc = speed
move.drot = rot

cont.activate(move)

1 Ответ

0 голосов
/ 21 августа 2011

GameLogic - это модуль расширения C.Он будет работать только в игровом движке, при запуске из контроллера игровой логики python, есть много примеров файлов онлайн, показывающих, как это делается.

...