7 Replies Latest reply on Nov 21, 2007 9:36 AM by adam@blueapplestudio

    How do you create different anitmations on same object

    Roofy Level 1
      Hi there,
      I trying to make some different animations on the wheels of my car in Plasma. What I like to have is have one keyframe player that spins the wheels when the car is moving forward or backwards. Then I would like another keyfram player that rotates the front wheels when the car is turning. Now in Maya, this is really simple to do. All you have to do in Maya is tell it to create a new clip. Then you can create a new animation onto the same object. However, I can't find an answer for Plasma. I first thought that by creating a new track would be somthing simular, but when I create a new track in Plasma, my first animation that I made is still their, meaning it did not create a clean slate so that I can apply new rotations to the wheels. In addition, if I go to the end keyframe and type in new values, then I lose my first animation that I created previously. So how do I create different rotation cycles to the same object without losing the previous made animation?
        • 1. Re: How do you create different anitmations on same object
          Level 7
          Roofy wrote:

          > Hi there,
          > I trying to make some different animations on the wheels of my car in Plasma.
          > What I like to have is have one keyframe player that spins the wheels when the
          > car is moving forward or backwards. Then I would like another keyfram player
          > that rotates the front wheels when the car is turning. Now in Maya, this is
          > really simple to do. All you have to do in Maya is tell it to create a new
          > clip. Then you can create a new animation onto the same object. However, I
          > can't find an answer for Plasma. I first thought that by creating a new track
          > would be somthing simular, but when I create a new track in Plasma, my first
          > animation that I made is still their, meaning it did not create a clean slate
          > so that I can apply new rotations to the wheels. In addition, if I go to the
          > end keyframe and type in new values, then I lose my first animation that I
          > created previously. So how do I create different rotation cycles to the same
          > object without losing the previous made animation?
          >

          Hi. You have to create a sequence of animations. From frame 1 to 35,
          animate the wheels spinning, from 35 to 75 the rotation and so on.

          Then in SW3D you choose the beginTime and endTime (in milliseconds, not
          frames) of the motion. IIRC, you can also take a look at the map() 3D
          function that makes a mix of several motions, although I�d recommend
          you to use the model.rotate() approach for spinning the wheels as a
          motion seem to be unnecesary.

          Another approach would be not doing a sequence of animations. Instead,
          make many scenes, each one with one animation and then only export the
          animation data to the W3D within the SW3D exporter. That way you�ll end
          up with one W3D cast member per motion and you�d have to clone them to
          the main SW3D scene.

          If you choose this way, remeber to preload() SW3D members and checking
          its .state = 4 property before cloning. Then unload them so they don�t
          take any CPU resources because of the motions being played inside the
          cast member even if it�s not on the score.

          HTH,
          --
          Agust�n Mar�a Rodr�guez

          www.onwine.com.ar > Macromedia Director demos & code
          • 2. Re: How do you create different anitmations on same object
            Roofy Level 1
            Hi, and thank you for giving me some pointers. Acutally the tip you gave me saying that it is better to use model.rotate, is kind of what I wanted to do in the first place. However, here is my problem. I have been asking questions here about how does the racycast car collision script works and I sort of undersstand it enough to use it on my car. So basically I created simple track and included my car into the scene in Plasma. Then I applied the raycast script to my scene in Director, and when I went to play it, the FPS was only playing at 23 FPS even though I have the tempo set to 60 FPS. So I then thought to do a test by setting the hover distance to 0, and the FPS increased to about 31 FPS. It is still not what I want for my animation, but it did increase. So I thought maybe if I just group the wheels to the chassis and applied keyframe animations to the wheels, then maybe it would increase the FPS closer 60. I really did not wanted to do it this way so maybe any of you could give me another work around?
            • 3. Re: How do you create different anitmations on same object
              Level 7
              Roofy wrote:
              <snip slowness with raycasting>

              About modelsUnderRay aligned with an axis (as in, don't do that):-
              http://nuttybar.drama.uga.edu/pipermail/dir3d-l/2005-November/010090.html

              Andrew


              • 4. How do you create different anitmations on same object
                Roofy Level 1
                Andrew, once again you saved the day.
                Actually after reading the article from the link you gave me, I first thought I was not doing that, but when I added the nudge to the downDirection, it fixed it. Could you explain why this fixed it?

                here is part of my script before adding a nudge

                -- Find the downward direction of the chassis in world space
                tempTrans = pChassisMDL.transform.duplicate()
                tempTrans2 = tempTrans.duplicate()
                tempTrans.position = Vector(0,0,0)
                tempTrans.scale = Vector(1,1,1)
                worldDownDir = tempTrans * pLocalDown
                worldDownDir.normalize()

                and here is part of the script after adding a nudge
                -- Find the downward direction of the chassis in world space
                tNudge = vector(0.0001, 0.0001, 0.0001)
                tempTrans = pChassisMDL.transform.duplicate()
                tempTrans2 = tempTrans.duplicate()
                tempTrans.position = Vector(0,0,0)
                tempTrans.scale = Vector(1,1,1)
                worldDownDir = tempTrans * pLocalDown
                worldDownDir.normalize()
                worldDownDir = worldDownDir + tNudge

                I ask this because I was wonder if my script should allways do this or if when worldDownDir is equal to a certain vector?

                also maybe you could help me with my other problem? My other problem was this. I eventually truly wanted not to use any raycasting for calculating the hover distance by using 4 linear dashpots, one for each wheel, and 4 angular dashpots, one for each wheel. I tried setting this up in Plasma, but when I preview the simulation in the havok preview window, first, I get a warning that says all the wheels are interpentatrating with the chassis. I click on the contiue button anyways, pressed play, and the chassis looks like it is trying to stay stable, but then either chassis jitters arround or the wheels collapse. So my question is I wanted to know where are the angular dashpots BodyA and BodyB vectors are supposed to be positioned? I understand how this sounds confusing, and I would give you my file but it is a p3d file which is for Plasma, and I was not sure if you could open it. However, if you can open it, then I would be glad to give it to you. So please let me know if you can or not open the file.
                • 5. Re: How do you create different anitmations on same object
                  Level 7
                  Roofy wrote:
                  > Andrew, once again you saved the day.
                  > Actually after reading the article from the link you gave me, I first
                  > thought I was not doing that, but when I added the nudge to the
                  > downDirection, it fixed it. Could you explain why this fixed it?

                  I think I first read about it on the dirGames-L mailing list. It /might/ be
                  something to do with some optimisation that can be made when not seeking
                  along a line parallel to an axis.

                  > I ask this because I was wonder if my script should allways do this
                  > or if when worldDownDir is equal to a certain vector?

                  Just make sure no component of the direction vector is zero, I suppose.

                  > also maybe you could help me with my other problem?
                  > So please let me know if you can or not open the file.

                  No, I can't. If you're lucky, someone else will offer.

                  Andrew


                  • 6. Re: How do you create different anitmations on same   object
                    Level 7
                    Roofy wrote:
                    > Hi, and thank you for giving me some pointers. Acutally the tip you gave me
                    > saying that it is better to use model.rotate, is kind of what I wanted to do in
                    > the first place. However, here is my problem. I have been asking questions here
                    > about how does the racycast car collision script works and I sort of
                    > undersstand it enough to use it on my car. So basically I created simple track
                    > and included my car into the scene in Plasma. Then I applied the raycast script
                    > to my scene in Director, and when I went to play it, the FPS was only playing
                    > at 23 FPS even though I have the tempo set to 60 FPS. So I then thought to do a
                    > test by setting the hover distance to 0, and the FPS increased to about 31 FPS.
                    > It is still not what I want for my animation, but it did increase. So I
                    > thought maybe if I just group the wheels to the chassis and applied keyframe
                    > animations to the wheels, then maybe it would increase the FPS closer 60. I
                    > really did not wanted to do it this way so maybe any of you could give me
                    > another work around?
                    >

                    Hi. You can still handle the wheels by rotating them with Lingo. Your
                    modelsUnderRay() slowness might be due to the high number of
                    polygons/models in the scene.

                    For improving the speed you might want to perform the raycast only with
                    a few models and not the entire scene. You could do that by:

                    1) On pre-MX2004, you create a group with the collision geometry and
                    another group with the visible geometry. Before performing the raycast,
                    you removeFromWorld() the visible geometry group, you addToWorld() the
                    collisionProxyGeometry group, you perform the raycasting and then you
                    remove the collision geometry and add the visible geometry again. It�s
                    like having two scenes in one but using them when you need.

                    2) In MX2004 a feature was added to modelsUnderRay(). You could send a
                    list of the models include in the detection. Find the MX2004 new
                    features con archives, Google or whatever... Tom Higgins explained it
                    and show the syntax (which I think it�s not on the docs).

                    About the animation in Plasma issue, I have no idea. Never used Plasma
                    myself nor my modelers because of the lack of global ilumination for the
                    texture baking and lightmaps. I still recommend you to use rotate()
                    instead of keyFRamePlayer for the wheels.

                    Good luck!
                    --
                    Agust�n Mar�a Rodr�guez

                    www.onwine.com.ar > Macromedia Director demos & code
                    • 7. Re: How do you create different anitmations on same   object
                      adam@blueapplestudio Level 1
                      I am trying to play different frame spans of a 3D animation as well, but I can't find the syntax for it. My scene was exported from LightWave, so I don't know if I have the ability to set endTime and beginTime as you can in SW3D. I have successfully added the keyframePlayer modifier to all of my models within the 3D cast member.

                      My three animations exist between 0 - 1.4 sec., 1.433 - 2.3 sec., and 2.333 - 4 sec. Can anyone point me in the right direction for playing and stopping these animations please?

                      Thanks.