I have a set of morph targets for character creation style body changes, which I need to do measurements on, I’ve been using line traces. When I change the body using the morphs targets, any line traces are hitting the original mesh shape and not the morphed mesh polys. Can I get the mesh to update the complex collision or something similar to get this to work?
I know this is an very old thread, but in case anyone is searching for this, you CAN get per-vertex positions from a skeletal mesh. I believe Rama’s plugin has a node for this - you just have to figure out which vertices you need to measure between and find the distance.
Thank you for answering, I appreciate it, but: That doesn’t work either. The vertices it gets are the original mesh verts, not the new locations created by the morph targets.
The calcs of morphs are done GPU side. Usually inaccessible.
the visibility channel isn’t updated to reflect those changes, so no. You cannot get a response via linetrace on a default engine build.
it’s quite a common pitfall. The data is there, ofc you should be able to make the calculations…
My solution was to change the simple collision to match the morph target item when it reaches 1.
this probably won’t work for you. You should look into customizing the engine to expose the data to the visibility channel.
- Morph disabled:
Left red line is trace line and hit location.
2). Morph enabled, mesh changed but
Hit location the same (green line after hit):
Debug duration persistent.
As MostHost said, I’m probably going to have to modify the engine at some point, but I haven’t had time to learn. Some guys from Epic promised to help when I met them, but never answered my emails so I gave up.
For anyone stumbling upon this through Google: I fixed my per poly collisions not working with morph targets. I read out the vertex positions after baking morph targets and used SkeletalMesh->BodySetup->UpdateTriMeshVertices() to update the collision mesh.
For baking the mesh I used this plugin: Morph Tools Plugin in Code Plugins - UE Marketplace
I guess the same could be done without baking the mesh first.