Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

blender game engine import error

Tags:

python

blender

i just started learning blender and its scripting and tried to run its sample code

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()

and get the following error: ImportError: No module named 'bge' i searched for a solution but couldn't find any.how to solve this problem? i am using blender 2.65

like image 213
Vaibhav Avatar asked Feb 02 '13 14:02

Vaibhav


People also ask

Why was Blender game engine discontinued?

In 2019, with the release of Blender 2.8, the Blender Game Engine was entirely removed from Blender itself. The engine's capabilities and appeal had largely fallen behind other rising game engines of the time, and it was difficult to update both Blender itself alongside the game engine.

Does Blender support game engine?

Blender has its own built-in Game Engine that allows you to create interactive 3D applications or simulations. The major difference between Game Engine and the conventional Blender system is in the rendering process.

What is BGE in Python?

Collection of the fake Blender Game Engine (BGE) Python API module for the code completion.


1 Answers

Running import bge does not work when you press "Run script" or try to issue this command in the terminal. You have to press "P" to activate game engine mode. To run your script, connect a controller to the script.

like image 135
fecub Avatar answered Oct 07 '22 13:10

fecub