How to recreate Havok physics shape based on morph target positions?

I have many meshes that get deformed visually via morph targets, and I’d like the deformed meshes to behave somewhat correct with respect to physics. So I was wondering if there’s an easy way to occasionally (i.e. obviously not every frame) remake the havok shape convex hull to reflect the morphed visuals.

If the morph target is changing VertexData (e.g. vertex positions), then recreating physics shape should be something like the end of this post about updating the PhysicsShape.

Right, but normally when you make a new physics shape (convex hull), you pass in a mesh and havok creates the convex hull from that. Since the positions in the morph target aren’t actually changing, this doesn’t work. Was wondering if there’s a way to do it

PhysicsShape is based only on vertex positions, not normals, tangents, uvs, etc.

Vertex position changes I think are happening in the GPU.

This post describes how to get the morphed position data to the CPU. From there, you may need to create a new mesh to then extract a physics shape.

This thread has more info about how you could get a physics shape from vertex data, but the PR was never submitted.

1 Like

Thank you!

I am still planning on making this PR, it’s just I still have a lot of other stuff I want to do first ^^

1 Like