Adding Behaviors to 3D Models

Posted: Feb 22, 2011 |Comments: 0 |

The movie above is scarcely spectacular. If you click on the rotating Box model, the background color of the 3D Models sprite changes, and a message is displayed telling you which face of which mesh has been clicked. Wow.

The big deal is that the code that does this is attached to the Box model itself, in the same way that a behavior is attached to a 2D sprite.

If you thought that you can't attach behaviors directly to models, then you are right. Almost. What you can do is add script instances to the userData list which is a property of every 3D Models node.

Behaviors have four main advantages over the script-instance-in-a-userData-list approach:

  1. You can drop a behavior directly onto a sprite
  2. You can set the parameters of the behavior without writing any code
  3. The built-in spriteNum property allows you to obtain a pointer to the sprite the behavior is attached to
  4. Director dispatches mouse and keyboard events automatically

You'll see how to work around (or to live with) these limitations in what follows.

Adding a behavior to the userData list

Here's the handler that creates the Box model, and which attaches an instance of the script("Model Instance") to the userData list. As you can see, adding the instance requires only a couple of code. If parameters were required, they could be set in the on new() handler, or in a separate on init() handler if you prefer to work that way. If you are prepared to get your braincells dirty by working in 3D Models Lingo, the loss of drag and drop functionality and the joys of thegetPropertyDescriptionList() handler are not going to upset you.

Questions and Answers

Ask
200 Characters left
Rate this Article
  • 1
  • 2
  • 3
  • 4
  • 5
  • 0 vote(s)
    Feedback
    Print
    Re-Publish
    Source:  http://www.articlesbase.com/art-articles/adding-behaviors-to-3d-models-4285362.html

    Article Tags:

    free download 3d model

    A more important correction, or re-evaluation, concerns the Microsoft VRML browser. The previous column noted that the Intervista World View browser supplied with Microsoft operating systems and Web browsers, might provide assurance that free VRML viewers would be broadly distributed in the near future. I stated that the Microsoft browser would be included in the standard install for Windows 98, but this requires some further clarification. As I now understand it, new machines with Window 98 ins

    By: karinl Arts & Entertainment> Artl Mar 13, 2011

    Frustrated with Expensive, Challenging to use and Cumbersome Boat Design software program?

    By: Daris Maslowl Computersl Mar 08, 2011 lViews: 152

    3D models is has play a vital role in our society all over the world. It worth paying attention to as some countries in the world are not really doing,of which they pay so high to achieve a glimpse of 3D model and animations.

    By: Benjaminl Computers> Computer Gamesl Nov 12, 2009

    Human Anatomy 3D Models are comprised of many organs and body parts. These computer graphics are used everyday to bring thousands of animations to life. They are also used to demonstrate the dynamics of breakthrough surgery or to generate educational renders to show doctors about how to use a medical device.

    By: karinl Arts & Entertainment> Artl Apr 02, 2011 lViews: 138

    Cambridge, UK – 23 September 2010: AVEVA Group plc (LSE:AVV) one of the world's leading providers of engineering design and information management solutions for the plant, power and marine industries, today announced the release of the first 64-bit versions of its powerful visualisation and design communication technologies. This enables designers to take advantage of the greatly increased processing power of the latest 64-bit computers to create highly detailed and easily navigable 3D design v

    By: karinl Arts & Entertainment> Artl Feb 09, 2011

    The next consideration is the CPU, or processor. This is almost as important as RAM, so you should not skimp here either. The first thing to consider is a single or multiple processor solution. For most cinematic work, you will want to have a dual CPU system. Notice that we did not say more than dual-this is due to the way your 3D Program works with that components in your computer:

    By: IHTESHAMl Arts & Entertainment> Artl May 31, 2011

    This article is about learning. The way of learning how to use these powerful tools to dominate or just have fun online.

    By: thomasl Arts & Entertainment> Artl May 25, 2012

    Painting for sale and Art reproduction are in demand from different occasion period. Besides that there is a special time and appeal ,to network with all of them. There is no preplanned to obtain them:- On line or form a shop . You have to be keep in touch with some pointers that can directly lead you there and must provide the relevant material for which you are searching.

    By: robertmoore1l Arts & Entertainment> Artl May 23, 2012
    Ton Pascal

    "Leda And The Swan", by Leonardo da Vinci, is one of history's great art losses. From the surviving copies we can see its beauty, the masterly composition, and the complex emblematic symbolism. Leonardo went beyond the sexual act portrayed until then about this mythic story. The great popularity of this subject in the sixteenth century was due to the fact that it was then more acceptable to depict a woman having an act of copulation with an animal than with a man.

    By: Ton Pascall Arts & Entertainment> Artl May 23, 2012

    Art Reproduction tend to be terrific concept for decorating as they'll immediately provide beauty, add color and can enhance the actual overlook associated with home, office or even library whilst admire the very best quality duplication of unique artwork.

    By: architecturepaintingsl Arts & Entertainment> Artl May 23, 2012

    Oil paintings comes in all shapes and sizes and generally based on a variety of themes that appeal to all tastes. For oil painting, different painting materials are used like canvas and cardboard. Original oil paintings are most valuable art among other existing art, out of them some are valued at millions of dollars.

    By: robertmoore1l Arts & Entertainment> Artl May 22, 2012

    The movie above is scarcely spectacular. If you click on the rotating Box model, the background color of the 3D sprite changes, and a message is displayed telling you which face of which mesh has been clicked. Wow.

    By: karinl Arts & Entertainment> Artl May 13, 2011

    (I-Newswire) August 8, 2009 - Compressed 3D Models Still Look Great with VizUp 3! VizUp unveils a new polygon reduction system that enables anyone to reduce the number of polygons in a complex 3D model up to 90% without much effect on its visual quality

    By: karinl Arts & Entertainment> Artl Apr 02, 2011

    A swift and fast demonstration to a string about images for 2D as well as 3D artwork to be able to create a powerful illusion regarding motion is usually understood seeing that animation. The skill of creating moving items with the effective use of computers has the name computer animation and is also sometimes called computer-generated symbolism or computer-generated image resolution (CGI). A movie has become the forms about presenting toon, as can also be a video program and all kinds of other

    By: karinl Arts & Entertainment> Artl Apr 02, 2011

    I have just began to study Photoshop. Now I have created a 3D model by 3D tool and now I want to paint on the 3D model. I know that we can use 3D tool to realize, but I don't know how to operate. Any help is appreciated.

    By: karinl Arts & Entertainment> Artl Apr 02, 2011

    Human Anatomy 3D Models are comprised of many organs and body parts. These computer graphics are used everyday to bring thousands of animations to life. They are also used to demonstrate the dynamics of breakthrough surgery or to generate educational renders to show doctors about how to use a medical device.

    By: karinl Arts & Entertainment> Artl Apr 02, 2011 lViews: 138

    Discuss this Article

    Author Box
    Articles Categories
    All Categories
    Quantcast