Hi
Im working on a map editor, and having a couple of problems, I have a
top view and make a rayquery like this
1 - mouse = camera.coord2d_to_3d(event[2], event[3])
2 - new_center = camera.position()
3 - #context = soya.World(scene)
4 - context = scene.RaypickContext(new_center, 1)
5 - result = context.raypick(camera.position(), camera.vector_to(mouse))
As in the tutorials, I try inestead of the contex.raypick the
self.raypick but id didnt work, I see that self refers in the examples
to soya.World, so I tried uncommenting the line 3 and comenting the
1,2,4 but it didnt work..
Anyway, as is its working "fine" I can raytrace from the top view and it
returns a Point, and a Normal, so I just place a palm tree in that
position :
palm_model = soya.Shape.get("palm_soya")
palm = soya.Volume(scene, palm_model)
palm.set_xyz ( impact.x, impact.y, impact.z)
palm.solid = 1
I exec the same raytrace and it returns the same point with the same
parent object, the ray goes through the recently placed palm and I liked
to be able to select that palm tree, I tried several things, nothing work..
The other problem is more strange, with that same code, when it places
the palm (when I click with mouse1) if a select a point far away from
the center it adds a extra offset to the impact point; For example I
select a screen point (lets say in a 1024x768 screen) that is in
1000x700 inestead of placing the palm shape in that point it places it
in the 1100x710 something like that, the farther away from the center
the bigger the "offset" I get.
Im also trying to do some gui following the instructions in
http://openglgui.sourceforge.net/gui_tut1.html so Im doing some widgets
are there any way that raytrace also hits a plane I made manually with
the opengl.glVertex2i(xxxxx)?
Sorry for the long post, and thx for any answer.