Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dodgyville | |
Old Version | Published before Godot 3 was released. |
Hi, I have some motion capture data recorded in BVH format.
I’d like to import it via GDscript, slightly remap and apply it to a character skeleton that I have imported as a Scene.
Each BVH frame contains data like this:
Leftleg: 'Time', 'Xposition', 'Yposition', 'Zposition', 'Yrotation', 'Xrotation', 'Zrotation'
for example:
Leftleg: 0.008, 324.790436, 86.519325, 779.784607, -109.290268, -2.373593, 12.830636
I’ve tried creating a new animation and a new track and adding the data like this:
var anim = Animation.new()
anim.add_track( 0 )
anim.track_set_path(0, "pathSkeleton:Leftleg")
anim.transform_track_insert_key( 0, 0.008000, Vector3(324.790436, 86.519325, 779.784607), Quat(-109.290268, -2.373593, 12.830636, 0), Vector3(1.0, 1.0, 1.0) )
animplayer.add_animation("dance", anim)
It doesn’t work and I get a lot of errors when playing the animation like:
ERROR: transform_track_insert_key: Condition ' t->type != TYPE_TRANSFORM ' is true. returned: -1
I think I need to do more to the location Vector3 and the Quat rotation than just a 1:1 transfer. Any suggestions would be appreciated.
Godot 3 has been great to work with so far and getting mocap data into godot would be amazing.
It looks like you’re adding the wrong type of track in add_track
. Should be 1 or Animation.TYPE_TRANSFORM
.
mollusca | 2017-11-03 07:42
Hey thanks! That really helped.
dodgyville | 2017-11-04 00:14