Author Topic: Camera.getPosition  (Read 717 times)

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Camera.getPosition
« on: August 14, 2014, 02:22:44 pm »
Is there an easy way to get the worldspace position of the camera in JPCT-AE ?

I would like to use it to see how far the camera is from an object, but getPosition doesn't give me the correct values. If I use the same code in JPCT is works as expected, but not in JPCT-AE.


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Camera.getPosition
« Reply #1 on: August 14, 2014, 03:40:31 pm »
getPosition() does give you the position in world space in both APIs and i'm not aware of any issues with it. I'm using it all the time and haven't had any problems. Maybe you can specify "doesn't work" a little more? Or can you create some test case where both APIs show different results?

Offline Mr_Chaos

  • int
  • **
  • Posts: 55
    • View Profile
Re: Camera.getPosition
« Reply #2 on: August 14, 2014, 05:28:48 pm »
getPosition() does give you the position in world space in both APIs and i'm not aware of any issues with it. I'm using it all the time and haven't had any problems. Maybe you can specify "doesn't work" a little more? Or can you create some test case where both APIs show different results?

I'll get you some more data, just wanted to know if it was a known problem.

An example

If I use camera.setPosition and then camera.getPosition the SimpleVectors are different, but i'll get some more data and return

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11746
    • View Profile
    • http://www.jpct.net
Re: Camera.getPosition
« Reply #3 on: August 14, 2014, 05:52:03 pm »
No, that can't be. The method returns the exact same values.

Code: [Select]
public void setPosition(SimpleVector pos) {
backBx = pos.x;
backBy = pos.y;
backBz = pos.z;
}

Code: [Select]
public SimpleVector getPosition() {
return SimpleVector.create(backBx, backBy, backBz);
}