reinstancePhysicsMesh() test

Upon hearing about the command reinstancePhysicsMesh(), I excitedly took a shot at making a sims/warcraft3 style level editor, wherein you can raise and lower terrain in real-time. the theory was that by calling the above command, collision would work out properly. so far, no dice.

in the attached file (made in apricot build 15606, but seems to work in 2.46), I’ve managed to get terrain shaping to work. The problem is, reinstancing it doesn’t seem to make any difference, and I get random crashes.
There are no guarantees the command works at all, I’ve certainly heard many people say there’s not way to do this in blender. but hey, there’s a chance they were wrong.

the reason for this post is twofold:
-does anyone see any glaringly obvious mistakes I’ve made that might cripple the script, and
-is the random crashing avoidable?

[edit] forgot to pack the texture, it’s fixed now (I hope).

Attachments

levelEditor.blend (240 KB)

I get an attributeError on init.py, setState on line 7
(You don’t have a state property on the grid)
It still randomly crashes, “Runtime error” even after I remove it…

I forgot, I used states (which aren’t in 2.46, but are in apricot) which is odd, because it ran fine when I tried it in 2.46. now I’m confused.

…the same crash happens after some random amount of time in both versions though.

well if it doesn’t work now… maybe it will be fixed… should be pretty usefull if you can get it working…

I have a suspicion that reinstancePhysicsMesh() is in the same boat as setPhysicsTicRate(), which doesn’t affect Bullet in any way. If it’s like setPhysicsTicRate(), then it might work with Sumo.

It would appear that you’re right. I switched it to Sumo and it appeared to work.

reinstancePhysicsMesh() does absolutely nothing…
Here’s the code


KX_PYMETHODDEF_DOC(KX_MeshProxy, reinstancePhysicsMesh,
"Reinstance the physics mesh.")
{
    //this needs to be reviewed, it is dependend on Sumo/Solid. Who is using this ?
    Py_RETURN_NONE;//(KX_ReInstanceShapeFromMesh(m_meshobj)) ? Py_RETURN_TRUE : Py_RETURN_FALSE;
}

All it does it return none :slight_smile:

It works for me

And this is quite promising… I see many aplications already, realtime clothing, water, terrain generation, collision deformation, rubber effect, it’s almost endless…

Excellent work, a tutorial is most requested.

I’m no programmer, but I’ve got the feeling that there is no refreshing of the mesh. As you keep the mouse button down, the frames also go down.
As I said it is good, but immature, keep up the good work!