Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - TRowland

#1
Support / Re: getting Object Size and Units
March 06, 2014, 07:40:36 PM
I think the issue that you are talking about - the object appearing as if it is 'behind' the marker is an issue caused by a mistake in the tutorial. I was facing the same issue until I noticed the setFovAngle and setYFovAngle functions in the javadocs for the camera class. The functions FOV setting methods are described like this in the JPCT javadocs:

void    setFOV(float tanFOV)
          Sets the FOV (within the limits set by setFOVLimits).
void    setFovAngle(float radians)
          An alternative to setFOV, which works directly with the angle.

and the instruction on the wiki is to calculate:

float fovYRadians = 2.0f * atan(0.5f * size.data[1] / focalLength.data[1]);
float fovRadians = 2.0f * atan(0.5f * size.data
  • / focalLength.data
  • );

    Which gives the angle for the FOV in radians, so setFovAngle(float radians) is required and not setFOV(float tanFOV) as the wiki has it. Alternatively, two atan calls can be saved if the calculation in the native code is changed to be:

    float fovYRadians = size.data[1] / focalLength.data[1];
    float fovRadians =  size.data
  • / focalLength.data
  • ;

    and setFOV(float tanFOV) is kept.