How to Add an object using python in the game...

Game Engine, Players & Web Plug-in, Virtual Reality, support for other engines

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Thu Nov 02, 2006 6:24 am

How to Add an object using python in the game...

Post by marianocuenze » Thu Nov 02, 2006 6:35 am

I am trying to develop some math simulations, and I need to create in the 'game' some mesh and other objects dynamically. I can do it inside blender (because I import the blender module into my python script), but... when I compile the game and I run the game, that module it is not available... can you tell me what I am doing wrong or when can I read about -I hope I will be able to add the blender module path or some thing like that.
I feel I can not add an object form code in the game, but I think I must be in an error. I have spent a lot of time (several months) and still I can not solve this. Really thanks for any help.

Posts: 0
Joined: Mon Oct 30, 2006 7:30 am

Post by haramanai » Tue Nov 07, 2006 11:16 am

I tried to use Blender Python Api with Blender Game but soon I realliezed that this is not posible. As far I understand Blender Game Engine is sepparated from main Blender in a way. I am not sure about that but I think Game Engine translates the parts of main Blender to be able to play them. Well I am saying too many things with bad english an I may confuse you. So I stop here.

marianocuenze : Just give up trying to use Blender Api with BGE. You must learn the BGE Api and try to do it with what you can find in there.
Also if I understand you well I have to say to you that you can add objects thru Python. You will just have to use the Edit Object Actuator. Also be sure to have the object that you wand to add in a sepparated layer from the visual layers of your game screen.

Try it out. If you have any questions I will be glad to help you if I can.

Post Reply