Camera Questions

Started by sgi, February 03, 2014, 12:30:57 AM

Previous topic - Next topic

sgi

I'm kind of new to OpenGL and this framework. I've been having some fun settings things up and researching. I have some questions so far:


  • I have been looking for an example of (re)positioning objects relative to the camera without moving the camera itself. Are there any?
  • Is it safe to assume that when creating a world the camera by default is placed at 0,0,0?

EgonOlsen

I'm not sure what exactly you mean by "relative to the camera". You can translate objects by using, well...translate(). If that has to happen relative to the camera, you have to calculate the new position based on the position of the camera by simply adding it and then do something like


obj.clearTranslation();
obj.translate(newPosition);


If you don't clear the translation in the case, the translations will add up.

To answer your second question: Yes!

sgi

With the second question answered, I think what I was looking for was Object3D#setOrigin. I basically was handed some prototypes by an intern and a lot of their examples involved moving the camera a lot, so I was looking for a better approach for my prototypes. Thanks for the help! :)