joseph.howell Posted March 1, 2017 Share Posted March 1, 2017 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 Link to comment
ded Posted March 2, 2017 Share Posted March 2, 2017 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. Link to comment
Recommended Posts