2 Replies Latest reply on Jan 3, 2007 7:47 PM by Sharkmenace

    addModifier method

    Sharkmenace Level 1
      I'm at a junction in learning Director and Javascript Syntax. I have finally managed to import 3D objects and move them in the 3D world.

      Now I would like to check for collisions by adding the collision modifier.

      However, after doing

      1. My model becomes immovable
      2. the collision property of the model comes up undefined-which means all other dependent properties are useless.

      Can anyone tell me how to do this using Javascript Syntax, Please?
      I'm really stuck.
        • 1. Re: addModifier method
          Ex Malterra
          sounds like your problem may be that models by default use their bounding spheres to determine collisions. if the models are close together their bounding spheres may collide before the meshes themselves causeing a cesation of forward movement.

          here's how to add the modifier to the model "myModel" in the 3d cast member "w3d" assuming myModel is the first model in the world:

          var myModel = member("w3d").getPropRef("model",1);

          here's how to acces the modifier's properties:


          for instance to write the collision mode to the message window use:


          by default that'll be //#shpere

          to change a property, like the collision mode, use

          member("ddd").getPropRef("model",1).getPropRef("collision").mode = symbol("mesh");

          now trace(member("ddd").getPropRef("model",1).getPropRef("collision").mode); will be //#mesh
          • 2. Re: addModifier method
            Sharkmenace Level 1
            Thanks, X
            I didn't think of using getPropRef() for each dimension of properties. I actually just broke down and learned lingo :D
            And yes the problems with the models being stuck was in fact resolved by using #mesh detection.

            I actualy had one model set to mesh and the other was the default, #sphere. It turns out I had to make them both #mesh.

            But as I said before, I have embraced Lingo.
            Thanks again.