Author Topic: get/use camera position/orientation and lights of a 3D Scene  (Read 11734 times)

Jan_K.

  • Jr. Member
  • **
  • Posts: 14
Re: get/use camera position/orientation and lights of a 3D Scene
« Reply #15 on: June 25, 2013, 02:00:12 PM »
Hello Jerome. Now i can set the Position of my camera. Thanks for that. But i got another Problem:
I want the camera to stay at the same position when i use the mouse to look around in the scene (like in an ego-shooter for example)
Now the camera position is always changed when i use the mouse to look around. So the pivot point seems not to be at the camera position. Is there a way to fix this?

Thanks much!
« Last Edit: June 25, 2013, 02:09:24 PM by Jan_K. »

jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: get/use camera position/orientation and lights of a 3D Scene
« Reply #16 on: June 26, 2013, 03:45:52 PM »
You're using the VolumeManipulator. This camera is for manipulating volume, this is the camera used in the viewer tool and some tutorial. The pivot is at the volume center, not at the viewer position.

You may wish to try instead the FreeCamera from the gamekit package, which possibly seem to do what you need.
The gamekit demo uses it in CameraMover (also used in the editor tool) and also shows how to sync the camera position with another object. The script moves a GameObject, but you can do same with a model if you need to.
« Last Edit: June 26, 2013, 03:47:16 PM by jerome_j »

Jan_K.

  • Jr. Member
  • **
  • Posts: 14
Re: get/use camera position/orientation and lights of a 3D Scene
« Reply #17 on: July 03, 2013, 04:15:44 PM »
Hello Jerome. Now i want to read out the Lights of the Scene. I implemented the onReadLight method like this:

"Lights" is of type Light. But wenn i print out "Lights" it says null. When i try to get Position or Colour of the Light like this:

   
and print out "LightPosi" and "LightColor" the console says:
LightPosi: Vec4(0.0, 0.0, 0.0, 0.0)
LightColor: null

What information is stored in the Light that is parsed by the onReadLight-method? Only Position or colours and other attributes too? Do you see an error in my code? Any idea why its "null"? Thanks

jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: get/use camera position/orientation and lights of a 3D Scene
« Reply #18 on: July 08, 2013, 10:28:02 AM »
Are you sure you're LightColor prints null, or you get a NullPointerException stack when trying to use Lights ?
Have you even checked onReadLight has been called ?

Jan_K.

  • Jr. Member
  • **
  • Posts: 14
Re: get/use camera position/orientation and lights of a 3D Scene
« Reply #19 on: July 17, 2013, 03:49:35 PM »
No the onReadLights()-method is not even called but there are several Lights in the scene... All of another type...Are there lights in one of the scenes of the tutorial to test it? Did you test it with fbx file extension?

THX

Jan_K.

  • Jr. Member
  • **
  • Posts: 14
Re: get/use camera position/orientation and lights of a 3D Scene
« Reply #20 on: July 17, 2013, 03:52:30 PM »
Our scene is available at: https://www.dropbox.com/s/ujgbk2rxwbtxc03/kleinerSendesaal10.fbx if you want to load it:)