Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  HUD, textoverlay with Java3D and wiered stuff...  (Read 4729 times)
0 Members and 1 Guest are viewing this topic.
Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #30 - Posted 2003-07-20 17:01:27 »

Quote
Once you have your rotated vector so that it is aligned with the direction the camera is facing you add it to your camera/player position and you are done.


If you do this, then you will still get the camera jitter problem when you move about 3km away from the origin.  

To get away from the camera jitter, we must leave the camera at the origin and move everything around the camera.  This solution is a hack to an obvious bug.

j3d.org has something in their FAQ about camera jitter but I don't think they address the problem we are talking about or maybe I'm not understanding their solution.
http://www.j3d.org/faq/speed.html#jitter

Ubuntu
Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #31 - Posted 2003-07-20 18:04:25 »



Ok, so here is the current problem.  In the picture above, we have the world rotating around our camera (which is always facing in the -z direction).  No matter how far the world gets away from the camera, it will always rotate around the camera in circles.

When we update the worlds position, (right now) we normalize the translation back to the origin.  We need to figure out how to normalize it to the direction of the camera is pointing I think Huh

Ubuntu
Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #32 - Posted 2003-07-20 21:26:55 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
//variables
Transform3D tmpTrans, positionHolder, posTrans, rotatorX, rotatorY, rotatorZ;
Vector3f position, vec;


// method for calculating translation component for world
      tmpTrans.set(position);
      positionHolder.mul(tmpTrans);
      positionHolder.mul(rotatorX);
      positionHolder.mul(rotatorY);
      positionHolder.mul(rotatorZ);
      positionHolder.get(vec);
      vec.x = -vec.x;
      vec.y = -vec.y;
      posTrans.set(vec);
      trans.set(posTrans);


Ok, the above code works; well sort-of.  After moving around a bit I get a wierd behavior (such as moving in the up instead of moving forward).

Well, I gotta go see Bad Boys II (at my friends request) so I'll try to figure out this wierd behavior tomorrow.


Ubuntu
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #33 - Posted 2003-07-20 21:27:12 »

Hi
 Unless i'm missing something, if you store a transform 3d (or a 4x4 float/double matrix) as your current location, and update just like you were originally doing, then you get the transform for your top world transformgroup, you can just take the inverse of the location matrix.

This is how I implemented a camera in native GL.

HTH

Endolf

Offline Conzar

Junior Duke




There is nothing common about common sense


« Reply #34 - Posted 2003-07-21 20:21:00 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
      tmpTrans.set(position);
      positionHolder.mul(tmpTrans);
      positionHolder.mul(rotatorX);
      positionHolder.mul(rotatorY);
      positionHolder.mul(rotatorZ);
                                                                             
      //This takes the translation found in the above code
      //And inverts it to apply to world translation & rotation
                                                                         
      posTrans.set(positionHolder);
      posTrans.invert();
      wT.set(posTrans);


Ok, so this finally works.  Thanks endolf for your help.  Your method was soo much easier then mine.  A big note, with the above method you only need to update 1 TransformGroup to move the scene (instead of 4 like I posted before) since the rotation & translation information are calculated w/ 1 Transform3D.  

Well, if anyone wants the full source, I can code up a Class that handles this behavior.

Ubuntu
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #35 - Posted 2003-07-23 15:52:31 »

Quote
Ok, so this finally works.  Thanks endolf for your help.

No problem, just glad it's all working.

Cheers

Endolf

Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (46 views)
2014-10-17 03:59:02

Norakomi (37 views)
2014-10-16 15:22:06

Norakomi (29 views)
2014-10-16 15:20:20

lcass (32 views)
2014-10-15 16:18:58

TehJavaDev (62 views)
2014-10-14 00:39:48

TehJavaDev (62 views)
2014-10-14 00:35:47

TehJavaDev (52 views)
2014-10-14 00:32:37

BurntPizza (70 views)
2014-10-11 23:24:42

BurntPizza (40 views)
2014-10-11 23:10:45

BurntPizza (82 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!