Exchange material of object in GE? PhysicsId & actuators of an object

My knowledge on how materials work in the GE (in contrast to normal Blender) is mostly non-existing and the only stuff about materials I found in the GE python-API references is for material/color per vertex, not per object.

Is it possible to change the whole material (i.e switch to another one) of a mesh via script in the GE? BTW: I’m currently using “Use Blender Materials”.

Werner

Create copy of mesh and assign different material to it, then in game use Replace mesh actuator.

1 Like

So this means it isn’t possible to switch materials directly?
Anyway, that workaround will do nicely for most things I have in mind - thanks :slight_smile:

Werner

I don’t think it’s possible to switch materials using Python. It can be done by extention module for Python written in C/C++.

Ok. Thanks for the info.

btw some related GE/python questions … Is there a way to get all actuators that are assigned to a (Game)Object? and what is the “PhysicsId” (also: where can i use it?).

Werner

During game you have access to current controller that runs the script and all sensors and actuators that are linked to it. You can’t access other controllers and their actuators and sensors.
PhysicsID is identification of bullet physical object. I haven’t use it yet.