5 Replies Latest reply on Sep 20, 2006 12:23 AM by Newt99

    Adding a light in Lingo

    extol Level 1
      Can someone please help me with this? I want to have a light under a car model that shines down on the ground. I know how to create a light in Lingo, but I can't seem to get it to position under my model. Also, can I attach the light to the model?
        • 1. Re: Adding a light in Lingo
          Newt99 Level 1

          You can attach any node to any other node in the scene graph. A node can be a model, a group, a camera or a light. Use the addChild() method with the #preserveWorld parameter. By the way, you can attach the light to the model in 3DS Max, saving you the hassle of the code.
          • 2. Re: Adding a light in Lingo
            Ex Malterra Level 1
            been using javascript syntax for some time, so my lingo is a little rusty. others can probably help with my errors. but it would go something like:

            -- car stuff
            theCar = member("w3dmember").node("carNode")
            carPos = theCar.getWorldTransform().position
            -- light stuff
            theLight = member("w3dmember").light("theLight")
            theLight.getWorldTransform().position = carPos
            -- make light child of car
            theCar.addChild(theLight,#preserveWorld);

            you'll now need to point the light at the ground, don't know what state everything was in befroe adding light, but rotating it shoudl work,

            theLight.rotate(-90,0,0)

            hth
            • 3. Re: Adding a light in Lingo
              extol Level 1
              Thanks for the help, guys. I am trying to make it so you can click on a car to get details about it and the selected car has a glowing circle under it (that follows the terrain below). I want to be able to do it dynamically.

              I tried adding a spot light in 3ds Max and put it exactly where I wanted and how I wanted it to look, but when I exported it to director, it isn't right. I tried rotating, and everything. I just can't seem to the the light UNDER my model and to shine down into a small circle on the ground. Any ideas?
              • 4. Re: Adding a light in Lingo
                Newt99 Level 1

                In that case, I would fake it.

                I would use a plane textured with an alpha channel bitmap of a round with a transparent feather effect (for the glow). I would set the emissive color of the shader for this round to rgb(255,255,255) to light it. Then, I would just set the visibility of this plane object to #both / #none when I want to display / discard it.

                You can create the bitmap in Firefox by creating a Shape, then clicking + to add the glow then select the transparent color for the background (in the Properties at the bottom). Then save as PNG (default).

                Cheers,
                Karl.

                http://www.chromelib.com
                • 5. Re: Adding a light in Lingo
                  Newt99 Level 1
                  I meant Fireworks, not Firefox ;-)