1 Reply Latest reply on Nov 22, 2007 2:52 AM by GlennoUK

    help with addChild needed please :)

    GlennoUK
      Hi,

      Ive got a modelResource of a 'Torso' from one castMember, and also a model of a 'Right Hand'' from another castMember.
      The Torso ModelResource contains a child 'right finger' that is designed for me to add the 'Right Hand' Model as the child of this 'right finger'. Then the 'Torso' Model can be Bones animated and the 'right Hand' model will follow suite.

      But when I use addChild to add the 'right hand' model as the child of the 'right finger' child. It keeps its relative position, so is out of place.

      The trouble is, the 'right hand' model in its own 3D CastMember, is positioned in the position a right hand would go, relative to a torso. So, when i add it to the 'right finger' as its child, its now in the posotion a right hand would go relative to a torso, but offset from the position and roation of the right finger.

      Ive tried using preserveWorld and preserveParent when I use addChild, but it doesnt have the expected results.

      Should i be transforming the 'right hand' model to an origin point or something like that, before i use addChild? or the other way round?

      Thanks in advance,
      Glen
        • 1. Re: help with addChild needed please :)
          GlennoUK Level 1
          I think Ive worked out my own problem...
          After I attach the model to the parent with addChild, i then set its transform to transform(). ie.
          theChildModel.transform = transform()

          Which solves the problem of the child being offset from the parent.

          (below is a seperate problem, I'm using a sphere primitive, so theres no issue with possibly the sphere having an popsitional offset when i attach it as a child. My previous question was in relation to when I attach the actual head object, which did have an offset)

          But Now, I have a problem with the parent being positioned incorrectly when I try to use boneplayer to animate it.
          I tried to get down to basics, to work out where the position was first going wrong, and its when i add the bonesPlayer modifier. These are the simple steps I take...

          I copy the Torso model into the 3D world. (this has a bone structure and a dummy Model in the correct position for head, hands, feet)
          Then I create a sphere primitive.
          Then I add the sphere as a child of the Torso's child[1] dummy Model, which I know is the 'head's dummy Model.

          That works fine, the sphere is in the correct 'head' position.

          But then when I add the bonesPlayer modifier to the Torso Model, the sphere jumps to an incorrect position(about in the middle of the torso model).

          Anyone experienced something like this before? Should I be doing something first before I add the bonesPlayer modifier?

          I have a very trimmed down demo of what Im talking about, if anyone would like to see the code.

          Any help greatly appreciated.
          Glen