Remove/reset compound collision shape?

Title says it all. Is it possible to “reset” an object’s collision shape to its original, after compound shapes have been added in-game?

unparent them?

That removes the child itself, but its collision shape is not removed from the parent.

What? The only way to model your own collision mesh is to make the custom collision mesh a parent of your original mesh.
Could you please provide a sample blend file demonstrating the problem?

That’s some funky stuff. As a workaround you might have luck with owner.reinstancePhysicsMesh()
If that doesn’t work, my only other idea is to re-add the object.

Wait… do I understand this right?

I have the same problem before,

however not anymore…
what version are you using?

are the children parented after the game starts or?

and reinstance physics mesh only works on triangle mesh.

is the compound root marked compound and not the children?

Yup, you understood it fine XD
As BPR said, reinstancing only works with non-compound triangle-mesh collision shapes. Re-adding the object is actually my problem: when I add another version of the object, it inherits the compound collision shape of its previously added counterpart, rather than spawning with a fresh, original, un-augmented collision shape.

Version 2.71.
Yes, children are parented to the object after the game starts, at the moment the object is spawned.
The “compound root” object has the “compound” option on; the children do not, but are added with


The 1 enabling compound parenting, the 0 disabling ghost collision. In other words, the objects get added to the collision shape just fine; the problem is, when another instance of the object spawns (needing a different arrangement of children to form a different collision shape) it inherits the shape, instead of starting with only its own collision shape (just the “sphere” setting).

I’m not modeling a collision mesh; rather, I’m using the “compound” feature to combine collision meshes.
Blend demonstrating the problem:
EXAMPLE-compoundSpawnProblem.blend (490 KB)

LibNew - I had the same problem some time ago.

Excellent; thank you! :smiley:
Sorry, but could you give me a little tutorial or example on how to do so? I’m afraid I’m unexperienced with the whole Lib part of Blender Python.

This does not bode well.
Much workaround. Very effort.

Welp, thanks, guys! I think I figured out a workaround; it’s convoluted and SHOULD be unnecessary, but hey, if it works XD (which we will see…)
Anyway. I really appreciate the help.

Hey I know it’s been like 5 years since that last post, but…
Did you ever get it working? I’ve had the exact problem for a while now, and can’t seem to find a solution.

Hi Thatrius,
I’ve since started developing in Unity so my memory’s a little hazy; later I can dig through my files and see if I have anything I can send you! However, from what I can remember, it worked roughly like this:
You’ll have 2 files: your game .blend, and another which contains an empty object. When you need to regenerate the collision geometry of a given compound object, you append (or something?) the empty from the other file, re-parent all your collision objects to the newly imported empty, and remove the old one (after transferring whatever properties are necessary to keep things running). This DID work, even if it’s a bit of a messy work-around, and didn’t have a significant performance impact (I think).

By importing from another file, you’re breaking the link to previous instances of the same object, so it doesn’t inherit the collision mesh from wherever the original’s cached (which is the problem I’d had when reinstancing the empty from the same file). There’s probably a better way to do this, but this is what I came up with at the time.

My current workaround is to unparent all objects whom parent to a copy of that data, and track ownership in a list, spawn new instances, and parent the stuff back to its owners.

How do you use Python to append from another file?

1st of all.
This isn’t your thread so I’m not even sure if I should be replying :thinking:

Over looking that . . .
This is the function that you are looking for -



Be warned that you can only import the following -

  1. Action
  2. Mesh
  3. Scene

libload is not what you need - watch this video

if we unparent all children from objects using the compound root shape you need to spawn - spawn the new root shape -> reparent everything it works fine.

He said -

Not Spawn object from internal scene.

Or am I missing something here with append function? :thinking:

Are you maybe replying to a different person?