How do I get all ADDED obj names?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Jedijds
Posts: 126
Joined: Mon Jan 30, 2012 5:19 am

How do I get all ADDED obj names?

Postby Jedijds » Thu Oct 11, 2012 7:01 pm

Cant figure out how objects from add object actuators are named.
Say I want to draw a line from one cube to all the other cubes that are added to the game scene from an object actuator. I set up a scrip on the cube I want all the lines to be drawn to.

cube1=bge.logic.getCurrentScene().objects['cue']
cube=bge.logic.getCurrentScene().objects['Cube']
render.drawLine(cube1.worldPosition, cube.worldPosition, [1,0,0])

‘cue’ is the name of the cube added to the first layer from the second layer through an add object actuator. (‘always’-‘and’-‘edit object’ in logic bricks)
‘Cube’ is the static cube I want the all the ‘cue’ cubes lines to be drawn to.

Problem: only the first cube that pops in to the scene gets a line. Why is this? How could I get all the cubes to have a line? (Do the added cubes have a different name?)
۞◄█°‖‖‖‖‖█ʭʭ╬(░▒▓▓▒▒▒▒▒▒▒▒▒)

Return to “Python”

Who is online

Users browsing this forum: No registered users and 3 guests