Hello,
How to get a bone's world position from a script?
apPortrait.SetBonePosition(apOptBone, targetPos) allows us to set a bone to a world position, however there is no method such as apPortrait.GetBonePosition(apOptBone).
There is apOptBone.Position, but it returns the bone's position in anyportrait's own coordinate system, which seems to be some sort of screen position.
Hi!
As you may have guessed, objects including apOptBone have values in AnyPortrait's coordinate system.
Therefore, if you want to obtain the world position in a scene, you should use a different approach.
If you enable the "Socket" option for Mesh and Bone, a "Socket" GameObject will be created separately when baking.
Socket is a Transform that contains the World Position of the object.
First, activate the Socket option of Mesh or Bone.
( https://rainyrizzle.github.io/en/AdvancedManual/AD_Socket.html )
Then, you can use the script to find and use the Transform type Socket.
Use "GetBoneSocket" / "GetOptTransformSocket" functions.
( https://rainyrizzle.github.io/en/Script/SC_Bone.html / https://rainyrizzle.github.io/en/Script/SC_Mesh.html )
Or, you can also find and use it directly from the Scene's Hierarchy.
A Socket is a simple Transform that takes the object's actual world space position or rotation instead, so you can use it easily.
If the problem is not resolved, please leave a comment!
Thank you.