Children Retaining Their Own Rotation
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2012 at 12:07, xxxxxxxx wrote:
Hello, I'm running into a problem with the rotation of an object created by a Python Generator. I want the object returned by it to always stay at the same position, rotation and scale, regardless of what happens to the Python Generator object and any parent it might have. I have the position not moving with :
StayStillObj.SetAbsPos(StayStillObj.GetMg().off - op.GetMg().off)
How would I do a similar thing with rotation?
def GetGlobalRotation(obj) : return utils.MatrixToHPB(obj.GetMg()) StayStillObj.SetAbsRot(-GetGlobalRotation(op))
But that doesn't work once more then one axis is rotated.Any ideas of how to get that working? Any help would be greatly appreciated.
Daniel
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2012 at 12:36, xxxxxxxx wrote:
Setting the childs' matrix to the inversed matrix of the parent-object negates the effect of the parent-matrix. Multiply with another matrix to specify the childs' matrix in global space.
obj.SetMg(~op.GetMg()) * offset_matrix
Use SetMl()/GetMl() to make the effect rely on the local space instead of the global space.
-Niklas
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2012 at 15:26, xxxxxxxx wrote:
Thanks, Niklas.
Wouldn't it be :
obj.SetMg(~op.GetMg() * offset_matrix )
And in this case what would offset_matrix be?
When I do:
child.SetMg(~parent.GetMg())
The child is rotated to a randomish rotation.
Dan
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/09/2012 at 01:08, xxxxxxxx wrote:
> >> Wouldn't it be :
Yes, I'm sorry. That was a mistake.Here's a little example.
Cheers,
-Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/09/2012 at 09:00, xxxxxxxx wrote:
Thanks again, Niklas.
That wasn't exactly what I wanted, I wanted global not local but you had already mentioned how to do that, so double thanks.