Week 8 Lab

Ian Hodgson

Week 8 Lab

Explore Python in Blender Game Engine in attemps to learn how python scripts run

3D interactive

Professor Baker

Thursday March 21, 2013

 

Objective:  Review previous class 3d environments using python editor.Continue exploring python game engine in order to learn how python scripts run

Materials:  MS Word, Internet, Blender, Logic editor, Python council, python reference library API, eclipse, 3d views, game logic template in blender, connecting eclipse.

 Methods: 

  • Blender.org – education – python reference – python API reference 2.6 – game engine module – game logic.bge
  • put code in text editor – assign sensors – connect to python controller – select script in python controller – press p in 3d views – don’t forget to name your script in text editor
  • text editor edit – text to 3d object ( to turn text into objects )
  • templates in text editor – game logic select object to view coding – rename file appropriately
  • eclipse py dev for blender – goto blender.org – manuals – books – program add on’s – blender 2.5 (using py dev in blender)
  • Control up  = will toggle screens in blender.

Data:

  • print (“moo”2*2*8)

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

Analysis:

  • Quotes are for strings.  with mathematical calculations allows for meaningful error messaging
  • White space in blender is useful to signal the end of a line. Use the tab keys to also end line.

Results: Learning game logic API with blender.  we successfully entered basic commands.  In order to see programs run, a sensor needs to be added. successfully reviewed programs in templets.

Discussions:  discussed how to use eclipse with python in blender.  went over mid term paper due after spring break.

This entry was posted in Uncategorized. Bookmark the permalink.