1 Reply Latest reply on May 16, 2006 9:43 AM by _lw

    Dynamic 3d objects, animation and behaviour.

    Level 7
      Hello everybody,

      I'm making a game as part of my final work for school.
      It's a 3D game so I chose to use Shockwave 3D.

      I'm using a scene I imported from Lightwave.
      Now I want to dynamically add some spheres who will need to have their own
      behaviour.
      Right now, I have a script in my cast which I call upon in the main code, to
      create (the actual geomitry) and position the spheres. (OOP way of working)
      The dynamic sphere's load into the 3D world on the right positions, so
      that's no problem.

      The thing that is puzzeling me is: How do I make them move? (they'll need
      collision detecion later on aswell)
      On the main code I can use "on exitframe" to change the position of my main
      character-model, that doesn't work on the dynamically added script.

      Since the code (the behaviour script from the cast) for the Sphere's is
      dynamicly added, it should have it's own "on" trigger. (i think)
      I'm still searching for solutions on the net, but I've been searching for
      quite a while now.
      I hope my explanation makes sense, I you'd need more info, I'd be happy to
      elaborate.
      Whatever help I can get is greatly appreciated.

      Thanks
      Thomas







        • 1. Re: Dynamic 3d objects, animation and behaviour.
          _lw Level 1
          you can use parentscripts, going this way you can add things to the "on stepframe" handler.
          this will only work if you add the script to the "actorlist". if you do not need it anymore you have to delete it from "the actorlist". all scripts that are in this "actorlist" will have the "stepframe" handler executed. if they are not in this list, its not executed.

          by the way i would not put all animations on the exitframe handler, because it will run a little more smooth when you only "go the frame" on "exitframe"

          on exitframe me
          go the frame
          end

          on enterframe me
          doallanimations
          end

          cheers!