You can not OR capability bits.
 
just change:
 
myTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ|TransformGroup.ALLOW_TRANSFORM_WRITE);
 
to
myTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
myTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
 
Alessandro
 
 
 
 
----- Original Message -----
Sent: Tuesday, July 22, 2003 1:15 AM
Subject: Re: [JAVA3D] Animating body

Hi all!
 
I looked at Alessandro's scenegraph (what he suggested in his post once) and to main. My body parts all have a TG as parent.
All body parts classes were created with the following logic:
 
public class RightShin extends TransformGroup{
 
    public RightShin() {
 
        TransformGroup joint = new TransformGroup();
        TransformGroup leg = new TransformGroup();
        javax.media.j3d.Transform3D t3d1 = new javax.media.j3d.Transform3D();
        javax.media.j3d.Transform3D t3d2 = new javax.media.j3d.Transform3D();
 
        t3d1.setEuler(new javax.vecmath.Vector3d(0.0, Math.PI/2.0f, 0.0)); //szög
        t3d1.setTranslation(new javax.vecmath.Vector3d(0.0d,-0.165d,0.0d)); //pozició
 
        setCapability(TransformGroup.ALLOW_TRANSFORM_READ | TransformGroup.ALLOW_TRANSFORM_WRITE);
        setTransform(t3d1);
 
        t3d2.setTranslation(new javax.vecmath.Vector3d(0.0d,-0.10d,0.0d));
        joint.addChild(new Sphere(0.03f,Sphere.GENERATE_TEXTURE_COORDS,new PAppear("c:/work/texturelibrary/Architectual/limesto3.jpg")));
 
        joint.addChild(leg);
        leg.addChild(new Cylinder(0.03f,0.17f,Cylinder.GENERATE_TEXTURE_COORDS,new PAppear("c:/java.jpg")));
 
        joint.setTransform(t3d2);
        addChild(joint);
    }
}
I have tried to include a rotationinterpolator in one of my body classes ex. for the other leg. Here is the code
 
public class RightLeg extends TransformGroup{
 
    public RightLeg(BoundingSphere boundingSphere) {
 
        TransformGroup jointTG = new TransformGroup();
        TransformGroup legTG = new TransformGroup();
        javax.media.j3d.Transform3D jointTransform = new javax.media.j3d.Transform3D(); 
        javax.media.j3d.Transform3D legTransform = new javax.media.j3d.Transform3D();
 
        jointTransform.setEuler(new javax.vecmath.Vector3d(0.0, Math.PI/2.0f, 0.0));
        jointTransform.setTranslation(new javax.vecmath.Vector3d(0.07d,0.07d,0.0d));
        jointTG.addChild(new Sphere(0.03f,Sphere.GENERATE_TEXTURE_COORDS,new Appear()));
 
        setCapability(TransformGroup.ALLOW_TRANSFORM_READ|TransformGroup.ALLOW_TRANSFORM_WRITE);
        setCapability(TransformGroup.ALLOW_CHILDREN_READ);
        jointTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ|TransformGroup.ALLOW_TRANSFORM_WRITE);
        jointTG.setTransform(forgoTransform);
 
        legTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ|TransformGroup.ALLOW_TRANSFORM_WRITE);
        legTransform.setEuler(new javax.vecmath.Vector3d(0.0, Math.PI/2.0f, 0.0)); //szög
        legTransform.setTranslation(new javax.vecmath.Vector3d(0.0d,-0.095d,0.0d));
        legTG.addChild(new Cylinder(0.03f,0.17f,Cylinder.GENERATE_TEXTURE_COORDS,new Appear())); //a lab hengere
        legTG.setTransform(labTransform);
 
        jointTG.addChild(labTG);
        Alpha alpha = new Alpha(-1,60000);
 
        TransformGroup objSpin = new TransformGroup();
        forgato.setCapability(TransformGroup.ALLOW_TRANSFORM_READ|TransformGroup.ALLOW_TRANSFORM_WRITE);
        RotationInterpolator rotInt = new RotationInterpolator(alpha,objSpin);
        rotInt.setSchedulingBounds(boundingSphere);
 
        objSpin.addChild(jointTG);
        addChild(jointTG);
        addChild(rotInt);
 
    }
}
 
If i add rotInt as child of the parent TG at runtime it drops me the following error:
 
javax.media.j3d.CapabilityNotSetException: Group: no capability to set transform
 
 at javax.media.j3d.TransformGroup.setTransform(TransformGroup.java:105)
 
 at javax.media.j3d.TransformInterpolator.processStimulus(TransformInterpolator.java:156)
 
 at javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
 
 at javax.media.j3d.J3dThread.run(J3dThread.java:250)
 
... without any error being in my source files. I have set the Capabilities in my TG. I have set them in all TransformGroups i am using.
 
Please help me! What should i do with this?
 
Bye,
        Levi

Reply via email to