www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: eye1 on March 22, 2007, 02:19:36 pm

Title: saving and seting camera position
Post by: eye1 on March 22, 2007, 02:19:36 pm
I would like to do this:

At some point I would like to save current camera position and direction. Which i do with getPosition() and getDirection().
I save those numbers to file
Than at some point I would like to retrieve those number and set camera to saved position and direction.
I use setPosition().. but can't find the method setDirection()??

Is there a way i can save the direction and then retrieve it again?
 
Title: Re: saving and seting camera position
Post by: Melssj5 on March 22, 2007, 02:51:04 pm
Well, you must use a Rotation Matrix, there is a post about this. let me find it.
Title: Re: saving and seting camera position
Post by: eye1 on March 22, 2007, 03:11:58 pm
I will be glad if you do   :)
Title: Re: saving and seting camera position
Post by: raft on March 22, 2007, 05:11:17 pm
this should do the trick:

Code: [Select]
Camera.setBack(direction.getRotationMatrix().invert3x3());
Title: Re: saving and seting camera position
Post by: EgonOlsen on March 22, 2007, 05:44:14 pm
Either that, or store the result of Camera.getBack() in new Matrix and set that when needed. Depends if you want to store direction only or the matrix itself.
Title: Re: saving and seting camera position
Post by: eye1 on March 23, 2007, 01:36:25 am
thank you...  :)