6 Replies Latest reply on Apr 17, 2013 1:30 PM by Necromanthus

    look at

    tyree_2 Level 2

      does anyone have a working example of a look at constraint in director. to have a model, alway look at another model. point at only works with the camera not models

        • 1. Re: look at
          Necromanthus Level 2

          Hi,

           

          pointAt works for any object:

           

          member(whichCastmember).model(whichModel).pointAt(vectorPosition{, vectorUp})

          member(whichCastmember).camera(whichCamera).pointAt(vectorPosition{, vectorUp})

          member(whichCastmember).light(whichLight).pointAt(vectorPosition{, vectorUp})

          member(whichCastmember).group(whichGroup).pointAt(vectorPosition{, vectorUp})

           

          The object’s front and up direction vectors are defined by the object’s pointAtOrientation property.

           

          cheers

          • 2. Re: look at
            tyree_2 Level 2

            Ill rephrase. it works but not correctly  a character standing on the ground will be flipped on its back hovering in the air.so its feet are always pointing at the object.

             

            does anyone have an example of a chracter or object other than a camera or light not loosing its own orientation when using point at

            • 3. Re: look at
              James Newton, ACP Level 3

              You can set the pointAtOrientation of the character.

               

              I imagine that the character has been created with the z-axis pointing upwards and its y-axis pointing forwards. By default, a model "looks" down its negative z-axis, with its y-axis pointing up.

               

              Try this:

               

              model("myCharacter").pointAtOrientation = [vector(0, 1, 0), vector(0, 0, 1)]

               

              Also, you might like to ensure that the target of the pointAt() command is at the same height as the origin of the character model, so that the character remains vertical.

              • 4. Re: look at
                Necromanthus Level 2

                tyree_2 wrote:

                 

                Ill rephrase. it works but not correctly  a character standing on the ground will be flipped on its back hovering in the air.so its feet are always pointing at the object.

                 

                does anyone have an example of a chracter or object other than a camera or light not loosing its own orientation when using point at

                 

                As I (and James) stated before, you need to define the "front" of the object.

                The object’s front and up direction vectors are defined by the object’s pointAtOrientation property.

                For example, a simple mesh and a bones controlled mesh have different points of orientation.

                Inside of the 3D modeler (3DS Max) you can change the rotation of the pivots.

                Also, depending on your needs, you can perform an additional operation after pointAt.

                Example:

                member("w3d_name").model("alien").pointAt(member("w3d_name").camera(1).transform.position, vector(0,0,-0.9999))

                member("w3d_name").model("alien").rotate(90,0,0)
                I hope it's cristal clear now.

                 

                cheers

                • 5. Re: look at
                  tyree_2 Level 2

                  thanks to both I had already tried the point at orientation with no success. which caused me to come to the forum. Ill go back and have another try at it.

                   

                  I would not have considered models not having the same height. to be cause of concern when using point at. thats very problematic

                  • 6. Re: look at
                    Necromanthus Level 2

                    tyree_2 wrote:

                     

                    thanks to both I had already tried the point at orientation with no success. which caused me to come to the forum. Ill go back and have another try at it.

                    I would not have considered models not having the same height. to be cause of concern when using point at. thats very problematic

                     

                    In fact you're looking for pointAt restricted to the Z axis:

                     

                    objrot = member("w3d_name").model("alien").transform.rotation

                    member("w3d_name").model("alien").pointAt(member("w3d_name").camera(1) .transform.position, vector(0,0,-0.9999))

                    member("w3d_name").model("alien").rotate(90,0,0)

                    objrotZ = member("w3d_name").model("alien").transform.rotation.z
                    member("w3d_name").model("alien").transform.rotation = objrot
                    member("w3d_name").model("alien").transform.rotation.z = objrotZ

                     

                    cheers