Пытаюсь запустить простой скрипт движения камеры по движению мышки.
# Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
# To use a mouse movement sensor "Mouse" and a
# motion actuator to mouse look:
import bge.render
import bge.logic
# scale sets the speed of motion
scale = 1.0, 0.5
co = bge.logic.getCurrentController()
obj = co.getOwner()
mouse = co.getSensor("Mouse")
lmotion = co.getActuator("LMove")
wmotion = co.getActuator("WMove")
# Transform the mouse coordinates to see how far the mouse has moved.
def mousePos():
x = (bge.render.getWindowWidth() / 2 - mouse.getXPosition()) * scale[0]
y = (bge.render.getWindowHeight() / 2 - mouse.getYPosition()) * scale[1]
return (x, y)
pos = mousePos()
# Set the amount of motion: X is applied in world coordinates...
lmotion.setTorque(0.0, 0.0, pos[0], False)
# ...Y is applied in local coordinates
wmotion.setTorque(-pos[1], 0.0, 0.0, True)
# Activate both actuators
bge.logic.addActiveActuator(lmotion, True)
bge.logic.addActiveActuator(wmotion, True)
# Centre the mouse
bge.render.setMousePosition(bge.render.getWindowWidth() / 2, bge.render.getWindowHeight() / 2)
с оф.сайта, должно работать. Не могу понять в чем проблема. Если кто то сталкивался, то буду благодарен за любую помощь, сам уже весь мозг сломал. В системе стоит еще Python 2.6.3, но ведь эта версия Blender использует свой, встроенный Python насколько я знаю. Или может быть проблема в системных настройках и в том, что по умолчанию у меня установлен старый Python 2.6.3 и Blender пытается обрабатывать скрипты через него? В общем, буду благодарен за любую помощь, уже не знаю куда обратится просто.