Hi,

In an Attempt to implement terrain following I have used the following code

Point3d pickStart = new Point3d();
Vector3d down = new Vector3d(0.0, -15.0, 0.0);
Transform3D newT3d = new Transform3D();
newT3d.setTranslation(new Vector3d(0.0, 1.5, STEP));
newT3d.mul(ourTrans);
newT3d.transform(pickStart);

picker.setShapeRay(pickStart, down);

PickResult picked = picker.pickClosest();
if (picked != null){
PickIntersection intersect = picked.getIntersection(0);  //i get Exception on this
                                                         //line
Point3d nextpoint = intersect.getPointCoordinates();

System.out.println("moveStep  : Start Point  !! "
        + pickStart);
System.out.println("moveStep  : Next Point !! "
        + nextpoint);

double pickY = (pickStart.y);

pickY = pickY - 1.5;

if (nextpoint != null) {
        if (nextpoint.y != pickY) {
                Vector3d translate = new Vector3d();
                ourTrans.get(translate);
                translate.y = nextpoint.y +1.5;
                ourTrans.setTranslation(translate);
                //ourTrans.setTranslation(new
                // Vector3d(pickStart.x, nextpoint.y,
                // pickStart.z));
                trans.setTransform(ourTrans);
        }
}
}

I have a world made in 3dMax and imported using  a 3ds loader
the PROBLEM IS i get

Exception occurred during Behavior execution:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(ArrayList.java:507)
        at java.util.ArrayList.get(ArrayList.java:324)
        at com.sun.j3d.utils.picking.PickResult.getIntersection(PickResult.java:441)
        at SimpleKeyBehavior.processStimulus(SimpleKeyBehavior.java:83)
        at javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
        at javax.media.j3d.J3dThread.run(J3dThread.java:250)

very often at Line marked with java comment "//"

If anyone could help me why this exception is thrown or
why should the pick results have no intersection even though
the result is not null ...that is going to be quite a help


Vijay Dharap,
Infosys Technologies Ltd.



---- Introducing Spymac MailPro: http://www.spymac.com/mailpro/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


---- Introducing Spymac MailPro: http://www.spymac.com/mailpro/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to