- Home /
How to make a bone rotate facing towards a given Transform?
I have a makehuman model and I want its shoulder bone to face towards a given transform. I used this code: Vector3 difference = target_bone.position - transform.position; float rotationX = Mathf.Atan2 (difference.y, difference.z) Mathf.Rad2Deg; float rotationZ = Mathf.Atan2 (difference.x, difference.y) Mathf.Rad2Deg; transform.localRotation = Quaternion.Euler (rotationX,0f,-rotationZ );
But it doesnt seem to work properly. Any suggestions?
Comment