OritentedShape3D objects are used to perform the same function as the Billboard Behavior of the previous section. The major differences between these two choices are that OrientedShape3D object work for applications with more than one view where Billboards don't, and OrientedShape3D objects can be a shared object while Billboards can't.

This program shows how to use the OrientedShape3D class. As you see, The OrientedShape3D is not a behavior,but a Shape.

 public BranchGroup createSceneGraph(SimpleUniverse su) {

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

    Vector3f translate = new Vector3f();
    Transform3D T3D = new Transform3D();
    TransformGroup positionTG = null;
    OrientedShape3D orientedShape3D = null;
    Geometry treeGeom = createTree();

    //specify the position of the trees
    float[][] position = {
         { 0.0f, 0.0f, -2.0f},
         {-13.0f, 0.0f, 23.0f},
         { 1.0f, 0.0f, -3.5f}
    // for the positions in the array create a OS3D
    for (int i = 0; i < position.length; i++){
         positionTG = new TransformGroup(T3D);

         orientedShape3D = new OrientedShape3D();