Jump to content

Does Player::getdirectionfromscreen work?


photo

Recommended Posts

Posted

When I call getDirectionFromScreen it always seems to return NaN for each element of the vector. I assume that this method would return a vector in the direction of the given pixel but the documentation doesn't really give any help.

 

Thanks

Posted

Hi Joseph,

 

I've just played around with this method and couldn't get a NaN vector.

I tested it with this code:

int AppWorldLogic::update()
{
    if (Game::get()->getPlayer())
    {
        vec3 d = Game::get()->getPlayer()->getDirectionFromScreen(/*5, 5*/);
        Log::message("(%f %f %f)\n", d.x, d.y, d.z);
    }
    return 1;
}

Have tried orthographic projection matrix as well.

 

How do you call it? Maybe you can provide us with a small test scene so we can reproduce?

 

You're right, x and y arguments are for coordinates of a pixel.

We'll have the documentation fixed for this method.

×
×
  • Create New...