Main Menu
Menu

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.

Show posts Menu

Messages - Sebastian

#1
Support / How to get the "up" - part of the camera?
September 25, 2006, 03:36:16 PM
The rotation pivot is what I was looking for, thank you. Now I use a dummy object to rotate around the other object and place and align the camera to this object.

May I ask why the camera, object3d and light does not have a common interface? If they had a common interface, all could be used the same way with the same code.
#2
Support / How to get the "up" - part of the camera?
September 22, 2006, 09:35:42 PM
Thank you for the quick response, I will keep the inverse matrix in mind, it seems to be realy important. But sadly I don't get it to work. I think it would be great if it would be possible to set the up-orientation as a second parameter to the lookAt - method like it is possible in direct x, what do you think?

I integrated the code you showed me, and it works for the x axis, but funnily not for the other axes. But ok, that may be just my lack of understanding.

I tried to understand my problem from the root, and a lot of it is just my own stupidity. So instead of rotating the camera I tried a simpler task: rotating an object around another. But even this is something I don't get to work. Please have a look at the following code:


     // pointer is a little pyramid that should rotate around an object
     SimpleVector p = pointer.getTransformedCenter();
     // object is the rotation center
     SimpleVector o = object.getTransformedCenter();
     // v is the vector from the object to the pointer
     SimpleVector v = p.calcSub(o);
     // this shows that v.length is not constant!
     System.out.println(p+" "+v.length());
     // make a copy of v
     SimpleVector w = new SimpleVector(v);
     // rotate the copy a little bit
     w.rotateY(dy);
     // set the pointer to the new position = move it the difference
     // between old and new position
     pointer.translate(v.calcSub(w));


I let this code run every time I move the mouse. The problem is that it is not stable - the pointer rotates around the object, but it is also moving away from it (length of v is increasing). If I comment the rotation line out, than it is stable (ok, it does nothing then). Can this be a number precision error? What would be the best way to do this task? Another question is how to set an object to a new Position. A camera has a position, but an object does not have a setTransformedCenter-Method or something like that, and that is the reason I came to this translation construct.

Thanks for your help for this bloody beginner

Sebastian
#3
Support / How to get the "up" - part of the camera?
September 21, 2006, 05:29:37 PM
Hi,

a camera in 3d space can be defined by position, direction and up (the orientation). I found no way to access this up information in JPCT, and this is especially missing in the camera.lookAt(obj) method.

I need this for implementing a camera that can be rotated around a given object with the mouse. I wrote the following code for rotating around a object at the x axis:


     SimpleVector obj = object.getTransformedCenter();
     SimpleVector cam = camera.getPosition();
     SimpleVector v = cam.calcSub(obj);      
     Matrix m = new Matrix();
     m.rotateX(dx);
     v.matMul(m);
     v.add(obj);
     camera.setPosition(v);
     camera.lookAt(obj);


When I rotate around an object this way, the orientation flips around (upside-down) when I get close to a 180 degree rotation.

I think that this information is somehow stored in the camera.getBack() rotation matrix, but the math part of my has been shrunken since school  :oops:

By the way, did anyone use quaternions? I found some nice articles in the web about this, but I don't know how to integrate this with JPCT right know, I think there wait a lot of little traps like the column-or-row matrix question and such things when converting those examples from DirectX to the java JPCT world.

Thanks for any help

Sebastian[/code][/quote]
#4
Support / Isometric projection
September 11, 2006, 02:30:53 PM
Is it possible to use any kind of isometric projection (or axonometric projection) in JPCT, that means a non perspective view of an object? I don't need a perfect isometric view but it should allmost look like it. I know that this could be done in reality by setting the camera position practical to infinity and use a very high zoom factor, but I don't see how to get this in JPCT.

Thanks for any help

Sebastian
#5
Support / Need a new or enhanced Loader
July 11, 2006, 07:45:44 PM
Ok, I believe that would be possible. But if you could show by example the code of the M2 - Loader, it would be much easyer :-)
#6
Support / Need a new or enhanced Loader
July 11, 2006, 12:47:03 PM
Hi,

first I must say "thank you" for this great library. We think about using it in a commercial system. Would it be possible to see the source? I think about writing a additional loader for other formats or for retrieving more information (like texture and animation) from the files.

Best Regards,

Sebastian