Hello there,
Attached image is a screenshot of my Spine project window.
I am trying to make my player fist aim at my mouse direction during runtime in Unity.
By using FistAimL and FistAimR, this has no issue but will need a lot of calculations. Moreover, since FistAimR also controls part of the character's body rotation, I want to be able to separate the body rotation and the fist aiming.
As a result, I tried to move the LeftFist and RightFist components so that the fist aiming won't need much calculation, and this way, I can separate the body rotation, left fist aim, and right fist aim to 3 different control.
However, when trying to do that in Unity runtime, the RightFist and LeftFist seem locked. I used debug.log to check if the coordinates actually moved. The result is the coordinate actually changes, but the character stays froze.
Below is my code:
public void AimLeftFist()
{
Vector2 aim = new Vector2(
mousePosition.x,
mousePosition.y);
fistAimL.SetLocalPosition(aim);
fistAimL.Skeleton.UpdateWorldTransform();
Debug.Log(fistAimL.X + ", " + fistAimL.Y);
fistAimL.Update();
}
mousePosition is relative mouse position to player transform.
fistAimL is the bone "RightFist"
I have tried adding UpdateWorldTransform or Update to fistAimL and fistAimL.Skeleton and fistAimL.Parent.Skeleton and none of them works.
This function is placed in LateUpdate too.
Can someone please help? Thanks!