LinePick

BlitzMax Forums/MiniB3D Module/LinePick

siread(Posted 2007) [#1]
I'm doing a linepick from EntityXYZ of one mesh to EntityXYZ of another. They are simply scaled cubes. I set the entitypickmode after scaling. I've tried EntityPickModes 1,2 and 3.

The first problem I encountered was that the line was picking the "from" entity. So I set its EntityPickMode to 0 before the linepick and reset it after.

However, with EntityPickModes 1 and 3 the linepick now returns null. When set to 2 i seem to get strange results where it picks the wrong target.


siread(Posted 2007) [#2]
I'm doing a linepick from A to B (EntityPickMode,2). I've used CameraProject to draw the line.

I set the color of the Entity returned from LinePick to Green. As you can see the LinePick is returning Entity C. What am I doing wrong?




siread(Posted 2007) [#3]
Doh! I was using the absolute co-ords of the second entity, not the offset from the first! Crisis over. :D


LAB[au](Posted 2007) [#4]
Is that a football/soccer field?


siread(Posted 2007) [#5]
Yes. Here's a slightly be view...



siread(Posted 2007) [#6]
Any ideas why EntityPickModes 1 and 3 (Sphere and Box) don't work on my entities? The Polygon mode is fine but terribly slow when using complex meshes.

I've tried setting EntityRadius and EntityBox but no joy.


simonh(Posted 2007) [#7]
Don't forget to use CreateOctree wish meshes to speed up picking.

Not sure why 1 + 3 don't work - they work in the CameraPick example. I'll take a look.


siread(Posted 2007) [#8]
Hmm, I tried CreateOctree, but that stopped my linepick working completely. Could max_polys and max_levels affect it? I tried the suggested values "200,5 for large meshes and 0,1 for small meshes".


simonh(Posted 2007) [#9]
Here's a LinePick example. Put it in the same folder as the CameraPick example. Seems to suggest everything is working OK (including CreateOctree):




siread(Posted 2007) [#10]
Must be something with my code then. Thanks Simon.