zobbo
April 2, 2015, 3:42pm
1
Hello,
What’s the C++ equivalent of base.camLens to get the default lens? The problem is I’m creating my own lens which can’t be right.
LPoint2 mousePoint = Application::GetWindow()->get_mouse();
LPoint3 from(0,0,0);
LPoint3 to(0,0,0);
PerspectiveLens lens;
bool result = lens.extrude(mousePoint,from,to);
from = Application::GetWindow()->get_render().get_relative_point(camera_,from);
to = Application::GetWindow()->get_render().get_relative_point(camera_,to);
printf("MouseHandler::SetTarget from:x %d y: %d z: %d\n",
from.get_x(),from.get_y(),from.get_z());
printf("MouseHandler::SetTarget to :x %d y: %d z: %d\n",
to.get_x(),to.get_y(),to.get_z());
rdb
April 2, 2015, 3:49pm
2
PT(Lens) myLens = window_framework->get_camera(0)->get_lens();
myLens->extrude(...);
zobbo
April 2, 2015, 5:30pm
4
I’m getting some insane values for the to Point. What does that indicate, the ray is not hitting anything? It should be hitting my Bullet objects according to the cursor.
LPoint2 mousePoint = Application::GetWindow()->get_mouse();
LPoint3 from(0,0,0);
LPoint3 to(0,0,0);
PT(Lens) lens = Application::GetWindow()->get_camera(0)->get_lens();
bool result = lens->extrude(mousePoint,from,to);
from = Application::GetWindow()->get_render().get_relative_point(camera_,from);
to = Application::GetWindow()->get_render().get_relative_point(camera_,to);
printf("MouseHandler::SetTarget from:x %f y: %f z: %f\n",from.get_x(),from.get_y(),from.get_z());
printf("MouseHandler::SetTarget to:x %f y: %f z: %f\n",to.get_x(),to.get_y(),to.get_z());
But the output is something like:
MouseHandler::SetTarget from:x 5.325821 y: 42.636116 z: 0.125568
MouseHandler::SetTarget to:x 68278.875000 y: 79995.390625 z: 28931.072266
Why is the to value so large?
Cheers,
Zobbo
rdb
April 2, 2015, 5:51pm
5
No collision detection is being performed by Lens. These are the points on the near plane of the camera and the far plane on the camera corresponding to the given mouse position.
zobbo
April 2, 2015, 5:54pm
6
Yeah I realised I’m not doing the Raytest That’s just the conversion. I think I’ll pack it in for today
My physics runs on the server and that code is on the client so it wouldn’t work anyway.