I have a sensor that scales in game using animation. However, the collision bounds do not appear to update in game? When I run it with physics vis on, it still shows the exact same physics box even though it has changed size. How do I force an update?
Is this possible with an edit object “replace mesh” with a smaller mesh? What is the best way to do that? I currently have box collision bounds, will that have to be changed to triangle mesh, and does that negatively impact performance?
I have attached a link for download… I am attempting to do a crouch action, and have my body physics sensor box scale/move when hitting the “J” key, and it doesn’t update the collision bounds.
If you are using a shapekey action you’ll need “reinstancePhysicsMesh” to update te mesh. Make sure you only update the mesh when the action plays. An example in the blend. One thing I noticed though that when I play the animation and deselect the window of Blender reinstancePhysicsMesh is not working.
This appears to be what I need. I wasn’t using shapekeys before this, but can convert to that and test this. Haven’t really done much python at all before this, so Ill have to study the code, but looks like I can figure it out.
This appears to be what I need. I wasn’t using shapekeys before this, but can convert to that and test this. Haven’t really done much python at all before this, so Ill have to study the code, but looks like I can figure it out.
[/quote]
You don’t need a shapekey action. You could also do it by scaling a child object. I didn’t expect that just scaling the object would require to update the mesh with reinstancePhysicsMesh, so maybe Monster knows something more about this? Next step will be testing to scale with python (without an action) to see if this is an “action” issue or not.
EDIT: It seems that even with scaling through python using “localScale” the mesh doesn’t always update. Is this normal?
Okay, I figured it out. Only with a shapekey action it is really necessary to update the Mesh with reinstancePhysicsMesh. In every other case updating the Mesh isn’t necessary when colliding with objects with Collision Bounds set to “Triangle Mesh”.
EDIT: However, I might need a lesson on using compound objects because I can’t seem to make it work…
maybe i not understand well what you mean , but to me seem that work.(i mean just with cube->cube)
the coupound must be selected for both obj (parent and children) otherwise not work.
[/quote]
I’m sorry for my ignorance and thank you for helping me. So I set collision bounds to “box” and selected “compound” for both parent and child. But the action of the child won’t update. Am I still doing something wrong here?
I had used coupund some time ago, and just by chance I did not notice these problems.
to update the collision coumpound, you must reset parent. (this anyway, maybe this is not a bug)
as always, the real bugs are in the UI. (such as dynamic objects that become static if they are children, in the UI…EDIT: or maybe also this bug is children of the “master bug” children static!)
workaround:
children sensor -> no coupund (and not parent)
body mesh -> coupound
you have to set the parent in run time then, and when you change scale, you should remove parent and Reparent.:spin: