Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tornado7

Pages: 1 [2] 3
16
Support / Animation
« on: June 23, 2004, 11:12:48 am »
Ok, following your instructions now it works.... You ARE GREAT  :D

17
Support / Animation
« on: June 21, 2004, 12:11:49 pm »
So, I've modified the loadFerito() method as follow:

Code: [Select]

public void loadFerito(String name, float x, float y, float z){
     
      Object3D animateMe=null;  
     
      texMan=TextureManager.getInstance();
      texMan.addTexture(name+".jpg",new Texture(getDocumentBase(),"textures/feriti/"+name+".jpg"));
      Object3D[] animArray=Loader.load3DS(getDocumentBase(),"3ds/"+name+"_anim.3ds", 20f);
      animateMe=animArray[0];
      animateMe.setCenter(SimpleVector.ORIGIN);
      animateMe.translate (x, y+55, z);
      animateMe.rotateX((float)-Math.PI/2);
      animateMe.rotateMesh();
      animateMe.setRotationMatrix(new Matrix());
     
      animateMe.createTriangleStrips(2);
      animateMe.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
      animateMe.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
     
      //animateMe.build();
       
      Animation anim=new Animation(animArray.length);
      anim.createSubSequence("standing-up");
     
      for (int i=0; i<animArray.length; i++) {
    animArray[i].build();
    anim.addKeyFrame(animArray[i].getMesh().cloneMesh(true));
      }
     
      animateMe.setAnimationSequence(anim);
      animateMe.animate(0);
     
      theWorld.addObject(animateMe);
     
  }

where animArray[0] contains the first ferito's pose and animArray[1] contains the second that is, at this moment, the last. Running the applet nothing happens... Do you see any problem in my code?
Bye

18
Support / Displaying Objs Problem
« on: June 21, 2004, 11:14:58 am »
Hi Egen,

I've solved my problem... :mrgreen: The problem was in the order in which things are made; in fact, moving the calling of readConfigFile() (and conseguently the calling of loadFerito) after the constructor of the world, everything works fine.

Bye and thanks

19
Support / Animation
« on: June 17, 2004, 12:24:06 pm »
Ok, I'll try as soon as possible (after solving my previous problem that, as you can see in the forum is still here....).
Yes, ferito is a wounded; I've to create a simulator for an University Medical context.... I've to simulate situation like road accident, and so on...
Bye and thanks

20
Support / Displaying Objs Problem
« on: June 17, 2004, 12:19:41 pm »
theWorld is definited global:

Code: [Select]

public class ThreeDSimApplet extends Applet implements Runnable, KeyListener, MouseListener {
.
.
.
FrameBuffer buffer=null;  
World theWorld;            
TextureManager texMan=null;  
private Camera camera=null;
.
.
.
public void init() {
theWorld=new World();
.
.
.

I've followed your steps: I've moved ferito's definition and "adding to the world" into loadFerito() as follow:
Code: [Select]

public void loadFerito(String name, float x, float y, float z){
     
      Object3D ferito=null;  
     
      texMan=TextureManager.getInstance();
      texMan.addTexture(name+".jpg",new Texture(getDocumentBase(),"textures/feriti/"+name+".jpg"));
      Object3D[] feritoArray=Loader.load3DS(getDocumentBase(),"3ds/"+name+".3ds", 20f);
      ferito=feritoArray[0];
      ferito.setCenter(SimpleVector.ORIGIN);
      ferito.translate (x, y+50, z);
      ferito.rotateX((float)-Math.PI/2);
      ferito.rotateMesh();
      ferito.setRotationMatrix(new Matrix());
     
      ferito.createTriangleStrips(2);
      ferito.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
      ferito.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
     
      ferito.enableLazyTransformations();
      theWorld.addObject(ferito);
  }

Now I have not a null expection....but none "ferito" is displayed even if correctly loaded.... I'm becoming crazy  :shock:

21
Support / Animation
« on: June 16, 2004, 06:03:19 pm »
Another task: Animation. I have to start an object animation when something happens. First consideration, even if I problably I already know the answer: is it possible to import a keyframed animation created in Maya/3D Studio into jPCT? If, as I suppose, the answer is no let try to see if I have understood that way to create animations in jPCT: I load a 3ds file in which I’ve created variuos poses of my obj to animate (every pose corresponds to a keyframe); I load this file as usual, i.e.:
Code: [Select]

Object3D[] animArray=Loader.load3DS(getDocumentBase(),"3ds/ferito_anim.3ds", 20f);

every element of the array animArray is one of my poses (I guess), so after defining and instanciating an animation:
Code: [Select]

Animation anim;  
anim=new Animation(n);

where  n is the number of keyframes (poses) that I want to use. What is pretty cloudy to me is the way to use mesh (that I’ve to pass to the method addKeyFrame), in your documentation you say:
“Mesh can't be instantiated directly”, so in which way can I use them? After adding all my keyframes to the animation, it simply starts when I start the applet? In which you use the interpolation attributes?

Thanks a thousand of times

22
Support / Displaying Objs Problem
« on: June 16, 2004, 01:46:08 pm »
Hi Egon,

as you know I’m using a config file where an operator can decide how many objs to load and where to place them;  for instance:
Code: [Select]

ferito1=(-591,-74,-90)
ferito2=(-766,-82,246)

my init() is:
Code: [Select]

public void init() {

      theWorld=new World();
 
       String param = getParameter("FileToRead");
       
       if ( param != null){
      FileToRead = new String(param);
       }
       
       // Now read the file.
       readConfigFile();
.
.
.

theWorld.addObject(mondo);
theWorld.addObject(ferito);


where readConfigFile() is method that scans the config file; when it find out a line having the word “ferito”, it passes to a method loadFerito that name (completed with 1 or 2) and his coordinate:
Code: [Select]


public void loadFerito(String name, float x, float y, float z){
     
      texMan=TextureManager.getInstance();
      texMan.addTexture(name+".jpg",new      Texture(getDocumentBase(),"textures/feriti/"+name+".jpg"));
      Object3D[] feritoArray=Loader.load3DS(getDocumentBase(),"3ds/"+name+".3ds", 20f);
      ferito=new Object3D(0);
      ferito=feritoArray[0];
      ferito.setCenter(SimpleVector.ORIGIN);
      ferito.translate (x, y+50, z);
      ferito.rotateX((float)-Math.PI/2);
      ferito.rotateMesh();
      ferito.setRotationMatrix(new Matrix());
     
      ferito.createTriangleStrips(2);
      ferito.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
      ferito.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
     
      ferito.enableLazyTransformations();      
     

  }



Even if the two 3ds object are correctly loaded:

Code: [Select]

Loading Texture...textures/feriti/ferito1.jpg
Loading file 3ds/ferito1.3ds
File 3ds/ferito1.3ds loaded...55321 bytes
Processing new material 1.Mat0Tex1!
Processing object from 3DS-file: polySur
Object 'polySur_jPCT0' created using 694 polygons and 354 vertices.
Created 183 triangle-strips for polySur_jPCT0 in 1 pass(es)
Loading Texture...textures/feriti/ferito2.jpg
Loading file 3ds/ferito2.3ds
File 3ds/ferito2.3ds loaded...54631 bytes
Processing new material 1.Mat0Tex1!
Processing object from 3DS-file: polySur
Object 'polySur_jPCT4' created using 706 polygons and 360 vertices.
Created 178 triangle-strips for polySur_jPCT4 in 1 pass(es)


It’s displayed just the one in the last line of the config file. I guess this behavior is dued by the fact that
Code: [Select]
theWorld.addObject(ferito) is outside loadFerito() and so it passes just the last value of ferito to init(). So I’ve tried to move
Code: [Select]
theWorld.addObject(ferito) in the last line of the loadFerito method (and even
Code: [Select]
theWorld=new World() to avoid a null exception) to try to add an obj to the world for every ferito’s occurance, but nothing changes... Any suggestion.....Bye and thanks  :)

23
Support / Camera position object3D position mismatching
« on: June 16, 2004, 09:53:46 am »
It’s a problem related to the position of the obj in Maya’s world coordinates: placing the obj in the center on the Maya’s coordinates (0,0,0), it behaves correctly in jPCT’s world.

Bye and thanks again.
 :D

24
Support / Camera position object3D position mismatching
« on: June 14, 2004, 05:51:01 pm »
Hi Egon,

I’ve to implement the following capability: I need to place some objects in the world using custom coordinate. So, for decide where place objects I’ve to move myself in the world (by the camera) and, where I decide to place an object, pressing the right click, my applet has to pass the camera’s coordinate to a html page. I’ve created this feature in this way:

Code: [Select]

if (event.getButton()==MouseEvent.BUTTON3) {
    cameraPosition=camera.getPosition();
    cameraX=(int)cameraPosition.x;
    cameraY=(int)cameraPosition.y;
    cameraZ=(int)cameraPosition.z;
                 clicked=true;
                 rightClick=true;
}


then I’ve created a function that creates and places the object using the camera’s coordinates:

Code: [Select]

public void loadFerito(String name, float x, float y, float z){
     
      texMan=TextureManager.getInstance();
      texMan.addTexture(name+".jpg",new  Texture(getDocumentBase(),"textures/feriti/"+name+".jpg"));
      Object3D[] ferito1Array=Loader.load3DS(getDocumentBase(),"3ds/"+name+".3ds", 20f);
      ferito1=new Object3D(0);
      ferito1=ferito1Array[0];
      ferito1.setCenter(SimpleVector.ORIGIN);
      ferito1.translate (x, y+109, z);
      ferito1.rotateX((float)-Math.PI/2);
      ferito1.rotateMesh();
      ferito1.setRotationMatrix(new Matrix());
     
      ferito1.createTriangleStrips(2);
      ferito1.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
      ferito1.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
     
      ferito1.enableLazyTransformations();
     

  }


My problem is that the object in placed in a different position compared to the camera position where I’ve taken the camera’s coordinates. I guess the resulting camera’s coordinates don’t match the object coordinates method. Exist a way to make a matching?

Bye and thanks

25
Support / A texture error…
« on: June 14, 2004, 05:49:59 pm »
Ok, all right  :D

26
Support / A texture error…
« on: June 11, 2004, 04:40:48 pm »
Hi Egon,

another question/problem….. I’m loading textures in a generic way as follow:

Code: [Select]

File dir=new File("C:/Programmi/Java_SDK/bin/textures");    
       String[] files=dir.list();

        for (int i=0; i<files.length; i++) {
         String name=files[i];
         if (name.endsWith(".jpg")) {
            texMan.addTexture(name, new Texture(getDocumentBase(),"textures/"+name));
         }
       }


in init() method. In my previous version I’ve loaded some objs separately from my world in init() method too, as follow:
Code: [Select]

      Object3D[] ferito1Array=Loader.load3DS(getDocumentBase(),"3ds/ferito1.3ds", 20f);
      ferito1=new Object3D(0);
      ferito1=ferito1Array[0];
      ferito1.setCenter(SimpleVector.ORIGIN);
      ferito1.rotateX((float)-Math.PI/2);
      ferito1.rotateMesh();
      ferito1.setRotationMatrix(new Matrix());
     
      ferito1.createTriangleStrips(2);
      ferito1.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
      ferito1.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
     
      ferito1.enableLazyTransformations();


Now, I’m using a config file where I can decide to load or not the above obj, so I’ve decide to move the above code in another method, defined  by myself named loadFerito(). The problem is that when I perform this, the Sun Java Console says:

Code: [Select]
ERROR: A texture with the name 'ferito1.jpg' has been declared twice!

where ferito1.jpg is the texture associated with ferito1.3ds and the obj in the applet is obviously white.
If I move back the loading/defition obj code into the init() method everything works fine. Any explanation ? Bye and thanks

27
Support / Loading generic texture in an Applet
« on: June 09, 2004, 02:42:26 pm »
Ok, it works using slash. Bye and thanks  :D

28
Support / Loading generic texture in an Applet
« on: June 08, 2004, 05:17:15 pm »
Line 238 is:

Code: [Select]
for (int i=0; i<files.length; i++) {

29
Support / Loading generic texture in an Applet
« on: June 08, 2004, 11:32:42 am »
Hi Egon,

as you know I’m loading texture in this way:

Code: [Select]
texMan.addTexture("car1.jpg",new Texture(getDocumentBase(),"textures/car1.jpg"));

in my applet context. Considering that I’m using now a certificate, so I can access to the local filesystem, I’d like to load texture in a generic way using a for cycle (as you do in fps) :

Code: [Select]

File dir=new File("textures");
       String[] files=dir.list();
        for (int i=0; i<files.length; i++) {
         String name=files[i];
         if (name.endsWith(".jpg")) {
            texMan.addTexture(name, new Texture("textures"+File.separator+name));
         }
       }


but, when I run the applet the Java console says:

Code: [Select]

java.lang.NullPointerException
at ThreeDSimApplet.init(ThreeDSimApplet.java:238)
at sun.applet.AppletPanel.run(AppletPanel.java:348)
at java.lang.Thread.run(Thread.java:536)


there’s another way to load texture in a generic way in my context? Bye and thanks

30
Support / Loading texture problem while using certificate
« on: June 04, 2004, 08:27:07 pm »
No, looking in Java console no error appears, texture are correctly loaded and added to the texture manager…. And no, the applet isn’t placed in a jar file, is a “stand-alone” class file. I’m not pretty sure to understand what do you mean when you say: “where getDocumentBase() points to in both situations.”

Bye

Pages: 1 [2] 3