home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-06-21 | 1.8 KB | 81 lines |
- /*-----------------------------------------------------------------------------
- * Copyright(C) 1995,1996 Sony Corporation
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Sony Corporation;
- * the contents of this file is not to be disclosed to third parties, copied
- * or duplicated in any form, in whole or in part, without the prior written
- * permission of Sony Corporation.
- *
- * File: bird.java
- * Auther: sugino
- *---------------------------------------------------------------------------*/
-
- import vs.*;
- import vrml.*;
-
- public class bird extends Script {
-
- static String bodys[] = {
- "models/bird0.wrl.gz",
- "models/bird1.wrl.gz",
- "models/bird2.wrl.gz",
- "models/bird3.wrl.gz",
- "models/bird4.wrl.gz"};
-
- SFBool enable = (SFBool) getEventOut("enable");
-
- Kinemation birds[];
- float rotateArg[] = new float[4];
- int birdMax ;
-
- public bird () {
-
- SFNode t ;
- float f[] = new float[4];
- birds = new Kinemation[5];
- String[] s = new String[1];
-
- /* setup rotate argument */
- rotateArg[0]=rotateArg[2]=0.0f;
- rotateArg[1]=1.0f;
- rotateArg[3]=2.0f;
-
-
- f[1]=1.7f;
-
- for(int i=0;i<bodys.length;i++){
- s[0] = bodys[i];
- birds[i] = (Kinemation) Browser.createVrmlFromURL(s);
- birds[i].translate(f,birds[i].modeRelative);
- for(int j=0;j<20;j++){
- rotate();
- }
- }
- enable.setValue(true);
- }
-
- void rotate(){
- for (int i=0;i<bodys.length;i++){
- if(null != birds[i]){
- float nowf[] =
- birds[i].getWorldTranslation();
- birds[i].worldRotateDegree(rotateArg,
- birds[i].modeRelative);
-
- birds[i].worldTranslate(nowf,birds[i].modeAbsolute);
- birds[i].setNextPosture();
- }
- }
- }
-
- public void fly(ConstSFTime t, ConstSFTime now){
- rotate();
- }
- }
-
-
-
-
-
-