0 votes

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.

in Engine by (204 points)

It looks like you're adding the wrong type of track in add_track. Should be 1 or Animation.TYPE_TRANSFORM.

Hey thanks! That really helped.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.