You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/SnippetsForStaticAndSkeletalMeshes.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1238,6 +1238,30 @@ for idx, import_index in enumerate(import_map):
1238
1238
...
1239
1239
```
1240
1240
1241
+
Finally, animations in Unreal have a fixed number of frames, while often we have only keyframes (tuple of time and value).
1242
+
1243
+
For this reason a common operation is to generate a new keyframe from a non linear series of keyframes. The numpy.interp() function is really handy, the following snippets show how we get a vector at specific time from a series of non-linear vector-based keyframes.
1244
+
1245
+
```python
1246
+
definterpolate_vector(self, timeline, t):
1247
+
keys = []
1248
+
x_values = []
1249
+
y_values = []
1250
+
z_values = []
1251
+
for key, value in timeline:
1252
+
keys.append(key)
1253
+
x_values.append(value[0])
1254
+
y_values.append(value[1])
1255
+
z_values.append(value[2])
1256
+
1257
+
x = numpy.interp(t, keys, x_values)
1258
+
y = numpy.interp(t, keys, y_values)
1259
+
z = numpy.interp(t, keys, z_values)
1260
+
return FVector(x, y, z)
1261
+
```
1262
+
1263
+
Remember, you can use the same approach with quaternions, but NOT with rotators !
1264
+
1241
1265
## Animations: Getting curves from BVH files
1242
1266
1243
-
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...
1267
+
BVH files are interesting for lot of reasons. First of all, BVH is basically the de-facto standard 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