[Closed] LookAt Controller flipping bone exports
I’m exporting bone animations through a custom plugin, every thing works fine until you try putting a lookat constraint on a bone (say the head); the computed angles come out 180 degrees out. There is a work around using dummies and orientation constraints (though you have similar problems unless you check the local->local transform rule), Has anyone had previous experience of this ? and did you find a better solution.
This depends of tons of information!
How are bone orientations exported?
What is the default state of the orientation?
Does the bone have a directional vector for the lookAt as well as one governing its spin about that axis?
the bones are computed in a typical way…
“localTm” = boneTransform * (inverse parentTransform)
angles = localTm as eulerangles (in mxs so to speak)
position = localTm.translation part etc…
as I said before everything comes out perfect until you try using a lookat constraint directly. As for the lookat contraint I’ve no idea what your talking about. It’s used in such a way as it looks right as it were but has been exported in every conceivable configuration with no joy but having the bone in a contrived orientation just to get a correct export is not going to happen.
Well for a start rotations bound by a parent will always be bound in 0 – 180 degrees – it won’t roll-up. And from what your saying your getting everything in local space i assume:
position – (a.transform * inverse a.parent).pos
rotation – quatToEuler (a.transform * inverse a.parent.transform)
So the object thats bound by a lookAt constraint will need to be in the same coordinate space as its parent firstly. If it doesnt respect its parent space it’ll be off.
If the data is correct before adding the lookat constraint to the object, you can do this – print out the results of the objects orientation before and after and we can debug it.
bloomin’ typical, just added a straight off the menu lookat constraint onto the head and it exports fine arrrgggh . Nothings changed in the exporter or the viewer script :argh: thanks for the help though .