Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hey,
I get the rotation of a joint, at a specific frame, using this line of code:
Vector3 rotation = bvh.allBones[bone_index].localFrameRotations[frame_index].eulerAngles;

I'm trying to compose a bvh file by writing rotations which I take from localFrameRotations[]
It seems that localFrameRotations[] has different values to the original file, and I can't understand the reason they differ. Is it because you retarget the bvh animation to a different skeleton or because you use different axes?

I am asking, because when I'm composing a bvh file using the localFrameRotations[], the rotations don't look ok at all.
How can I use localFrameRotations[] and make these rotations useful to me?

(I am aware of the structure of a bvh file and that a rotation is written in z,x,y format).

Thank you :)

It's been a few years since I wrote the code but localFrameRotations should be the rotation of the bone's beginning so that it points towards its end, in other words it's a look rotation. You could try setting localFrameRotations using Quaternion.LookRotation(<the bone's worldspace forward Vector3>, <the bone's worldspace up Vector3>);