[Bf-committers] GE object instances Id?

Mitchell Stokes mogurijin at gmail.com
Thu Mar 12 20:45:32 CET 2009


Yes and no. If I understand you right, you want to do something like, "if
object a is a sheep, do this". This you can't do, since Blender itself does
not recognize this kind of OO thinking. All instances of game objects that
are made from the same blender object, and yes, each pid will be different
every time the game is run.

Now, to fix the issue. I believe YoFrankie! gives each object a property.
Like, the sheep have a sheep property, or something like that. In Python,
you can check to see if an object has the property your looking for.
Following the sheep example:

own = GameLogic.getCurrentController().getOwner()

if hasattr(own, "sheep"):
    print "I'm a sheep!"

I hope that helps.

On Thu, Mar 12, 2009 at 11:08 AM, Natanael Olaiz <nolaiz at gmail.com> wrote:

> Hi,
>
> I have a question about the Game Engine: there is a way to identify
> between different objects of the same type?
>
> I'm trying to use a script controller on YoFrankie!, that needs to
> identify the different instances of characters (rig_ram / rig_sheep /
> rig_rat /...), but all the instances give me the same name with
> getOwner().name.
>
> I just found the getPhysicsId() method, but varies every time I run the GE.
>
> There is a way to identify them?
>
> 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...
>
>
> Thanks in advance,
> Natanael.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20090312/d5c1491b/attachment.htm 


More information about the Bf-committers mailing list