Hi,
I have terrain that can be modified and I use staticmeshes for it.
After the vertex and index data is changed, I call
staticMesh.Mesh.Tree.Refit();
staticMesh.UpdateBoundingBox();
This works mostly fine. The problem is that when there is some still object on the mesh (I have tried sphere and CharacterController so far) and a hole is made into the mesh under the object, the object does not fall unless something hits it.
Can I inform the object somehow that the mesh has changed or is there some other possible fix for this? I tried disabling DeactivationManager in case it had something to do with the problem but it did not help.
Thanks!
Problem when modifying staticmesh
Re: Problem when modifying staticmesh
If there's an already known subset of objects you want to wake up, then just calling their entity.ActivityInformation.Activate() would work. If it's just the set of all objects colliding with the StaticMesh, iterate through the StaticMesh.Pairs list. Each Pair has EntityA and EntityB properties, among other things. One of them will be null because the StaticMesh is not an entity. The other can be activated by calling the entity.ActivityInformation.Activate() method.
It could also be that there are some cached contacts persisting through the change, supporting even an active entity. In this case, call the ClearContacts method of each pair.
It could also be that there are some cached contacts persisting through the change, supporting even an active entity. In this case, call the ClearContacts method of each pair.
Re: Problem when modifying staticmesh
Thanks Norbo! ClearContacts fixed the problem.