1
$\begingroup$

During the game I want to create a new Object that changes its physics mesh according to a selected ID with an Edit Object actuator and a script on the added Object. I change the mesh with the method obj.replaceMesh() and it works fine.
But when I add in another of the same object ingame, now using a different ID and therefore changing to a different physics mesh, the first object changes its physics mesh as well without the script running on it anymore.
I guess this is happening because they are basically the same object, and blender does not change the physics for the generated object in the game but for the source itself, changing every copy currently loaded in the engine.
Is there any way I can unlink the objects from each other, keeping their received physics mesh?

$\endgroup$
0
$\begingroup$

I don't think it's possible without a cumbersome LibLoad setup.

But you can use separate collision objects as a workaround.

Code

# Assumes the visual mesh is no-collision and the collision mesh holds logic
ob.replaceMesh('visualobject')
ob['collision'].endObject()
ob['collision'] = scene.addObject('collisionobject', ob)
ob.setParent(ob['collision'])

Example blend

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.