Author Topic: Camera Questions  (Read 735 times)

Offline sgi

  • byte
  • *
  • Posts: 2
    • View Profile
Camera Questions
« on: February 03, 2014, 12:30:57 am »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Camera Questions
« Reply #1 on: February 03, 2014, 07:38:13 am »
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

Code: [Select]
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!

Offline sgi

  • byte
  • *
  • Posts: 2
    • View Profile
Re: Camera Questions
« Reply #2 on: February 15, 2014, 06:49:47 am »
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! :)