emilianavt / BVHTools

BVH Tools for Unity
Other
200 stars 27 forks source link

[HELP] Convert Scientific Notation to Number #11

Closed cl3386 closed 1 year ago

cl3386 commented 2 years ago

Hi Author, First of all, great thanks for awesome project.

I am trying to import bvh file that was created in python3. Python3 automatically convert numbers that has a lot of decimal numbers to Scientific Notation such as "-1.25358e-05"

When I import my bvh file in Unity, it gives me following error: ArgumentException: Failed to parse BVH data at position 9638. Expected channel value around here: 4.8479 1.2379>>>9e-<<<06 -2.59538e-

I am trying to convert all the scientific notations(they are like thousands) to number in BVHParser.cs script myself, but I am struggling from doing it.

Can you give me any direction for achieving my goal?

Many Thanks!

emilianavt commented 2 years ago

Hi! Those are not valid BVH files, so I would recommend printing the numbers in a way that no scientific notation is produced on the Python side. The exact way to do this will depend on what kind of data you are handling (there are different print options for e.g. numpy and pytorch). If they are regular floats, you can try something like print(f"{your_number:.5f") to print it with five digits.