Deforming a StaticMesh
Posted: Thu Oct 06, 2011 6:04 am
Hey guys,
I was wondering what the best way is to deform a StaticMesh at runtime. Is there a good way to do it?
Right now all I can think of is to re-calculate my StaticMesh's vertices and indices everytime it gets a crater like impact that deforms it...and then remove the StaticMesh, and create a new StaticMesh with the updated vertices and indices.
This method gives me the exact result I want, which is the good part....unfortunately, the bad part is that creating a new StaticMesh every time there's an impact causes a very noticeable performance hit even when using multithreading. I've tried to just put my calculated values into staticMesh.Shape.TriangleMeshData.Indices and staticMesh.Shape.TriangleMeshData.Vertices, but that doesn't seem to do anything. Anything obvious I might be missing here?
I was wondering what the best way is to deform a StaticMesh at runtime. Is there a good way to do it?
Right now all I can think of is to re-calculate my StaticMesh's vertices and indices everytime it gets a crater like impact that deforms it...and then remove the StaticMesh, and create a new StaticMesh with the updated vertices and indices.
This method gives me the exact result I want, which is the good part....unfortunately, the bad part is that creating a new StaticMesh every time there's an impact causes a very noticeable performance hit even when using multithreading. I've tried to just put my calculated values into staticMesh.Shape.TriangleMeshData.Indices and staticMesh.Shape.TriangleMeshData.Vertices, but that doesn't seem to do anything. Anything obvious I might be missing here?