So now I want to move sphere 1 to the location of sphere 2 using the pose bone.
The problem, as you may have guessed, is that pose bones don’t follow world coordinates so I can’t just do something like posebone.location = sphere_2.location
I’ve found a couple things online about inverting the world matrix (or something) but I couldn’t get it working, perhaps because I’m not really understanding it. Amending somebody else’s solution I ended up with something along the lines of
is that the armature wasn’t added at the world origin.
A workaround was found by either adding the armature at the origin and translating the edit bones (messy)
Both are these are very good solutions, thank you!
@Weekend I don’t understand why that works so I guess I need to read up on matrices but it’s perfect
@kkar There is no reason to not do that, it just hadn’t occurred to me!
In any case, once I transferred this to my original project, on which the armature is already added to the scene, I just needed to make sure the transforms were properly applied manually for it to work and so managed to get away with my own solution while avoiding ugly code. The solutions suggested will definitely be committed to memory though.
Well I thought you want to keep the armature location as is, so I set the armature as ground zero for object b. you just need to subtract object a from the object b location matrix. (basically the distance of the two)