[Bf-committers] GE object instances Id?

Toni Alatalo antont at kyperjokki.fi
Thu Mar 12 21:39:23 CET 2009


Mitchell Stokes kirjoitti:
> All instances of game objects that are made from the same blender 
> object, and yes

.. "have the same name", i guess you meant to continue there.

indeed i didn't realize this talk was about the instancing during the 
running of the game, was just thinking of objects that have already been 
put to a scene on the modelling side before the game is started - those 
all have unique names.

> Yes and no. If I understand you right, you want to do something like, 
> "if object a is a sheep, do this". (...)
> own = GameLogic.getCurrentController().getOwner()
> if hasattr(own, "sheep"):
>     print "I'm a sheep!"
> On Thu, Mar 12, 2009 at 11:08 AM, Natanael Olaiz <nolaiz at gmail.com 
> <mailto:nolaiz at gmail.com>> wrote:
>
>     I have a question about the Game Engine: there is a way to identify
>     between different objects of the same type?
>

that case of 'if is sheep' etc. i would call "identify the types of 
different objects", not "identify different objects of same type", but 
perhaps am just used to a bit different terminology than Natanael :) .. 
the solution with properties is indeed nice for such typing if that was 
your need (identifying type and not an individual instance, in my / oo 
programming terminology).

>     BTW, I don't know if this is the proper list to ask this question. If
>     not, please tell me where I have to ask...
>

forgot to mention in the earlier quick reply that usually these usage 
things are asked on the forums, at least some years ago the 
blenderartists GE forum was really active and helpful, ppl knowing all 
sorts of tricks and hacks to weird problems even.

but i guess this kind of talk about IDs perhaps the least off topic kind 
of talk on the coders list :)

>     Natanael.
>

~Toni



More information about the Bf-committers mailing list