Hey guys. I have this 2d character in which I use IK to do animations. Im trying to make the character's hand move with the gun (the gun rotates with the mouse position). But whenever I move the IK Effector transform position from code, my char hands go crazy, rotating randomly. I'm using CCD Solver btw, tested with Contrain rotation on and off..
I implemented by doing this:
- My weapon has a script with makes it rotates with mouse position
- whenever it rotates, i get the weapon spriteRenderer.sprite.pivot position (which is set to where the hand should be)
- set rightArmSolver.GetChain(0).effector.position = weaponSprite.transform.position or pivot.position;