I am trying to create a spotlight, that is supposed to cast light like a
torch. It is placed in the camera. My problem is that when I get close to
an object, the spotlight goes out and the object turns black. I want the
object to get brighter as the camera (and spotlight) approaches it (as it
would if there was a torch).
If someone knows how to solve my problem, please reply ASAP!
Thanks,
Sofia
This is a part of the code that i am using (some of it from the demo
SphereMotion):
Vector3d lPos1 = new Vector3d(0.0, 0.0, -0.5);
Vector3f lDirect1 = new Vector3f(lPos1);
Point3f lPoint = new Point3f(0.0f, 0.0f, 0.0f);
Point3f atten = new Point3f(0.5f, 0.0f, 0.0f);
BoundingSphere lightbounds =
new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
Light lgt1 = new SpotLight(lColor1, lPoint, atten, lDirect1,
0.1f,1.0f);
lgt1.setInfluencingBounds(lightbounds);
TransformGroup l1RotTrans = new TransformGroup();
l1RotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Transform3D t = new Transform3D();
TransformGroup l1Trans = new TransformGroup(t);
l1Trans.addChild(lgt1);
l1RotTrans.addChild(l1Trans);
Transform3D t = new Transform3D();
TransformGroup l1Trans = new TransformGroup(t);
l1Trans.addChild(lgt1);
l1RotTrans.addChild(l1Trans);
PlatformGeometry pg = new PlatformGeometry();
ViewingPlatform vptest = u.getViewingPlatform();
Sphere pg_s = new Sphere(0.01f, app);
Shape3D pg_ss = pg_s.getShape();
pg_ss.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
pg_ss.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
pg_s.setCollidable(true);
Appearance pg_app = pg_ss.getAppearance();
pg_app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
pg_app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
TransformGroup pgTG = new TransformGroup();
Transform3D pgTrans= new Transform3D();
pgTrans.setTranslation(new Vector3d(0.0,0.0,-1.0));
pgTG.setTransform(pgTrans);
pgTG.addChild(pg_s);
TransformGroup testtest = new TransformGroup();
pg.addChild(testtest);
testtest.addChild(l1RotTrans);
vptest.setPlatformGeometry(pg);
===========================================================================
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".