home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-05-06 | 593 b | 21 lines |
- import vrml.*;
- import vrml.field.*;
- import vrml.node.*;
- public class Change extends Script {
- SFVec3f coord;
- float c[]=new float[3];
- float angle=0.0f;
- public void initialize() {
- coord = (SFVec3f) getEventOut("coord");
- }
- public void processEvent(Event e) {
- if(e.getName().equals("set_angle")==true) {
- angle=((ConstSFFloat)e.getValue()).getValue();
- c[0] = (float)Math.sin(7*angle*6.28);
- c[1] = (float)Math.cos(5*angle*6.28);
- c[2] = (float)Math.cos(3*angle*6.28);
- coord.setValue(c);
- }
- }
- }
-