Python blender游戏引擎导入错误
我刚开始学习blender及其脚本,并尝试运行其示例代码Python blender游戏引擎导入错误,python,blender,Python,Blender,我刚开始学习blender及其脚本,并尝试运行其示例代码 import bge def main(): cont = bge.logic.getCurrentController() own = cont.owner sens = cont.sensors['mySensor'] actu = cont.actuators['myActuator'] if sens.positive: cont.activate(actu) else: cont.deactivate(
import bge
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['mySensor']
actu = cont.actuators['myActuator']
if sens.positive:
cont.activate(actu)
else:
cont.deactivate(actu)
main()
并获取以下错误:
ImportError:没有名为“bge”的模块
我寻找了一个解决方案,但没有找到。如何解决这个问题?
我使用的是blender 2.65当您按下“运行脚本”或试图在终端中发出此命令时,运行导入bge不起作用。您必须按“P”键才能激活游戏引擎模式。要运行脚本,请将控制器连接到脚本