Example usage for javax.media.j3d Billboard ROTATE_ABOUT_POINT

List of usage examples for javax.media.j3d Billboard ROTATE_ABOUT_POINT

Introduction

In this page you can find the example usage for javax.media.j3d Billboard ROTATE_ABOUT_POINT.

Prototype

int ROTATE_ABOUT_POINT

To view the source code for javax.media.j3d Billboard ROTATE_ABOUT_POINT.

Click Source Link

Document

Specifies that rotation should be about the specified point and that the children's Y-axis should match the view object's Y-axis.

Usage

From source file:BillboardTest.java

protected BranchGroup createSceneBranchGroup() {
    BranchGroup objRoot = super.createSceneBranchGroup();

    TransformGroup objTrans = new TransformGroup();
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

    Transform3D yAxis = new Transform3D();
    Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0);

    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f,
            (float) Math.PI * 2.0f);
    rotator.setSchedulingBounds(bounds);
    objTrans.addChild(rotator);/*  www.j  a  v  a2 s  .c  o m*/

    objTrans.addChild(createBillboard("AXIS - 0,1,0", new Point3f(-40.0f, 40.0f, 0.0f),
            Billboard.ROTATE_ABOUT_AXIS, new Point3f(0.0f, 1.0f, 0.0f), bounds));

    objTrans.addChild(createBillboard("POINT - 10,0,0", new Point3f(40.0f, 00.0f, 0.0f),
            Billboard.ROTATE_ABOUT_POINT, new Point3f(10.0f, 0.0f, 0.0f), bounds));

    objTrans.addChild(new ColorCube(20.0));

    objRoot.addChild(objTrans);

    return objRoot;
}