I get CapabilityNotSet Exception, and I cant change that :(
Hai!
I just started using java3d to make 3d games.
If you dont have it just use this site to get an easy exe installer to install it in notime for you: https://java3d.dev.java.net/binary-builds-old.html
Anyways, I get that error when I try set a new direction for the light.
And if I try to do:
Code:
light.setCapability(1);
then it still gives me same error when I try change its direction...
I dont know how to fix this, can you help me?
Heres my code, it's all of it =)
Code:
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import javax.vecmath.*;
/**
*
* @author Andreas
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
SimpleUniverse uni = new SimpleUniverse();
BranchGroup bg = new BranchGroup();
Sphere sphere = new Sphere(0.5f);
bg.addChild(sphere);
BoundingSphere bound = new BoundingSphere(new Point3d(0,0,0),1000);
Vector3f dir = new Vector3f(0,-1,1);
DirectionalLight light = new DirectionalLight(new Color3f(0,0,2),dir);
light.setInfluencingBounds(bound);
bg.addChild(light);
uni.addBranchGraph(bg);
uni.getViewingPlatform().setNominalViewingTransform();
while (true){
for (int x = 0;x<10;x++){
try{Thread.sleep(100); } catch (Exception e){}
light.setDirection(x,-1,1);
}
}
}
}
Thanks for taking your time :)