Skip to content

Commit 60fdcc5

Browse files
author
Roberto De Ioris
authored
Update SnippetsForStaticAndSkeletalMeshes.md
1 parent 5dcff98 commit 60fdcc5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tutorials/SnippetsForStaticAndSkeletalMeshes.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,24 @@ This method is how we build the skeleton:
970970
return skel
971971
```
972972

973+
As you can see we change axis mapping for translations (x became y, y became z and z became inverted x), while we inverte pitch and roll for rotations. We always give priority to quaternions as they are more solid (albeit harder to grasp, the next snippet will show why they are extremely better than plain rotators/euler rotations)
974+
975+
Another important part is how we deal with morph targets. Internally the source_idx field of the MorphTarget object (like mentioned before) maps to an optimized index that is different from the one we used when we created the soft vertices array. Lucky enough, UE4 exposes an array that containes the mapping between the optimized index and the original one:
976+
977+
```python
978+
...
979+
# get the mapping
980+
import_map = self.mesh.skeletal_mesh_to_import_vertex_map()
981+
982+
# iterate mapping
983+
for idx, import_index in enumerate(import_map):
984+
# get the true index for accessing soft vertices data, use idx for source_idx
985+
vertex_index = original_vertices[import_index]
986+
...
987+
morph_target.source_idx = idx
988+
...
989+
```
990+
973991
## Animations: Getting curves from BVH files
974992

975993
BVH files are interesting for lot of reasons. First of all, BVH is basically the standard de-facto for motion capture devices. It is a textual human-readable format. And, maybe more important for this page, will heavily push your linear-algebra skills...

0 commit comments

Comments
 (0)