java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Java3D arrow How to implement key-frame animation by Morph
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 3899
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to implement key-frame animation by Morph E-mail
User Rating: / 6
PoorBest 

Interpolator classes change various visual attributes in the virtual world. However, there is no interpolator to change the geometry of a visual object. This is exactly what the Morph Class does. A Morph object creates the geometry for a visual object through interpolating from a set of GeometryArray objects.

The next list summarizes the steps to use a Morph object:

  1. create an array of GeometryArray objects
  2. create a Morph object with ALLOW_WEIGHTS_WRITE
  3. assemble the scene graph, including adding children to target Switch object(s)

Image

Image

public BranchGroup createSceneGraph() {

    // Create the root of the branch graph
    BranchGroup objRoot = new BranchGroup();

    Transform3D t3d = new Transform3D();
    t3d.set(new Vector3f(0f, -0.5f0f));
    TransformGroup translate = new TransformGroup(t3d);

    // create GeometryArray[] (array of GeometryArray objects)
    GeometryArray[] geomArray = new GeometryArray[4];
    geomArray[0= createGeomArray0();
    geomArray[1= createGeomArray1();
    geomArray[2= createGeomArray2();
    geomArray[3= createGeomArray3();

    // create morph object
    Morph morphObj = new Morph(geomArray);
    morphObj.setCapability(Morph.ALLOW_WEIGHTS_WRITE);

    // create alpha object
    Alpha alpha = new Alpha(-110020001000000);

    // create morph driving behavior
    MorphBehavior morphBehav = new MorphBehavior(morphObj, alpha);
    morphBehav.setSchedulingBounds(new BoundingSphere());

    // assemble scene graph
    objRoot.addChild(translate);
    translate.addChild(morphObj);
    objRoot.addChild(morphBehav);

    ...

    return objRoot;
  }

 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.