i need a bit help. I post here instead of the developer plugin to (hopefully) get more answers. I want to know how i detect which object the mouse is picking in the 3d scene.
I don't need the API command for this - i know this. I want to write my own function for this. From mouse click until selection.
What i found out so far is that i need the position of the mouse on screen (x, y) and the aspect ratio of the screen. With this informations i could "create" a ray from near to far by adding 0 and 1 to this coordinates.
Code: Select all
near = ( screen_space_x, screen_space_y, 0 )
far = ( screen_space_x, screen_space_y, 1 )Here comes my first problem: where can i get this matrices?
But i found a easier way because there is a function in the API which gives me the origin and the direction of the mouse directly from the screen position:
Code: Select all
tsxAViewGetMouseRay( mx, my, pRayOrigin, pRayDirection )Ok, pRayOrigin is the point of the eye in the world. pRayDirection is the normalized vector from this point into the world thrue the mouse point.
What i now need is a method to check the bounding box of each visible object in the scene against this ray.
Here i found a few solutions in the net but i don't understand all of them.
I hope anybody can help me out.

