BVHTools icon indicating copy to clipboard operation
BVHTools copied to clipboard

error while executing the code from ReadMe

Open cssddnnc9527 opened this issue 1 year ago • 9 comments

I try to run the last paragraph code of the read me file, but it fails as follows: I want to use my own bvh file to drive 3d Model.

无标题

Any idea will be appreciated !

cssddnnc9527 avatar Sep 09 '22 07:09 cssddnnc9527

It sounds like UnityEngine is not imported.

emilianavt avatar Sep 09 '22 08:09 emilianavt

How to import UnityEngine ?
Do I need to install UE in my OS?

cssddnnc9527 avatar Sep 09 '22 09:09 cssddnnc9527

BVHTools is a library written for use with Unity as part of a Unity project or game. It won't work stand-alone. The UnityEngine namespace provides functions to interact with the game engine and is usually imported by default when you create a new C# script in Unity.

emilianavt avatar Sep 09 '22 09:09 emilianavt

Very appreciated!

With your help, the compile errors gone. But met the error as follows: 无标题 I have my own *.fbx file, but I don't know where to put it, and where to set the file path.

Thanks again!

cssddnnc9527 avatar Sep 13 '22 09:09 cssddnnc9527

You have to put it in the scene. If you then attach the BVHAnimationLoader to the model's root in the scene, it should work.

emilianavt avatar Sep 13 '22 11:09 emilianavt

As following graph: 无标题

my scene name is "self", my 3d model is "X Bot", I also put "X bot" in the Assets category. But in the right part of the graph, I can't select Target Avatar. The error in the down left corner still exists.

What did I miss ? Looking forward your response. Best regards.

In addition, the content of "New Behaviour Script" is as follows: _using System.Collections; using System.Collections.Generic; using UnityEngine;

public class NewBehaviourScript : MonoBehaviour { // Start is called before the first frame update void Start() { BVHAnimationLoader loader = gameObject.AddComponent<BVHAnimationLoader>(); loader.targetAvatar = GetComponent<Animator>(); loader.clipName = "anim1"; loader.filename = "sampled_0_temp100_0k_0.bvh"; loader.parseFile(); loader.loadAnimation(); }

// Update is called once per frame
void Update()
{
   
}

}_

cssddnnc9527 avatar Sep 14 '22 02:09 cssddnnc9527

Your X Bot needs to be set to have a humanoid rig. I would recommend getting familiar with the basics of Unity's animation system.

emilianavt avatar Sep 14 '22 09:09 emilianavt

Ultimately the model can be driven by the BVH file, but it kept T pose and move very slightly which is obviously not correct.So I have three questions:

  1. What may the root cause be?
  2. I use the model and motion capture file(*.fbx) from mixamo.com, then transform *.fbx to *.bvh, but the effect is not ideal. Anything wrong with this process?
  3. Could you tell me where to get *.fbx and *.bvh which have same struture?

Thank you very much! Looking forward to your response.

Best wishes!

cssddnnc9527 avatar Sep 16 '22 06:09 cssddnnc9527

Perhaps the bone names and structure of the model and of the BVH file do not match. In that case you can use the translation map on the animation loader component an manually translate them.

For getting matching fbx and bvh file, the easiest method would be to record them with the recorder component.

emilianavt avatar Sep 19 '22 14:09 emilianavt