Using EntityPick

Blitz3D Forums/Blitz3D Programming/Using EntityPick

Jack(Posted 2005) [#1]
I am using EntityPick to find an object between "A" and "B".

No problem there.I find the closest to "A" OK.

What I need to do is find any other objects in the line on the wat to "B" after the first one.

The only way I can think of is to do another EntityPick from the first object,call that "C", to "B". And continue that procedure on to the "B" from any other objects found.

There must be a better way? Is there a way to just keep going with the first EntityPick and get ALL the objects in the line?

Also,and not as important,is there a way to get the dimensions and location of the objects? I have not really gotten into this part of the problem but it must be possible.

Thanks for any help.


Rook Zimbabwe(Posted 2005) [#2]
The only way I can think of is to do another EntityPick from the first object,call that "C", to "B". And continue that procedure on to the "B" from any other objects found.
Thats the way I did it.

There probably is a more elegant solution. I am more of a bruteforce programmer anyway.

-RZ


Jack(Posted 2005) [#3]
Thanks Rook.
Any ideas on the second prart of the question?


Beaker(Posted 2005) [#4]
You could probably adapt this to do what you want:
http://www.blitzbasic.com/codearcs/codearcs.php?code=793


Jack(Posted 2005) [#5]
That does look like something usefull.
I'll give that a try today.
Thanks Beaker


PowerPC603(Posted 2005) [#6]
I assume you're using 3D.

If all your objects are on 1 straight line between point A and B, then you could temporarily position your camera at point A, let it point to B and use CameraPick.

When you've found your first entity, then you could position your camera at the coordinates of that first entity, hide that entity, let your camera point to B again and use CameraPick again.

Hiding the entity will prevent you getting weird results, as your camera could be inside the entity.
If you would use CameraPick again, it could return the same entity (the first one) if a polygon of entity 1 intersects the CameraPick.


Jack(Posted 2005) [#7]
Thanks PowerRC603.

I was trying the same type thing with moving the start point of the "EntityPick" but something really wierd happens even before that.

The FIRST object hit is a tree made from a cylinder and a pyramid.Just those 2 pieces with one recorded as the parent.So on the "hit" I get the position withEntityX(),EntityY(),etc.That works OK as I get the actual position which is -20,0,-470.This is a "hit" on the PARENT.

So now I raise the target line and hit the "child" which is a
part of the parent and I get a "hit" but the position is listed as 0,8,0.What the heck is this?

I thought maybe it had something to do with the origination position but that can't be it since if I raise the pair ,say +20,my next hit will show a position of something like 0,11,0.

Anyone got an idea?


jfk EO-11110(Posted 2005) [#8]
do a linepick from A to B
result may be C
temporarily disable C using entitypickmode C,0
do a linepick from A to B again
result may be D
temporarily disable D using entitypickmode D,0
do a linepick from A to B again
result may be E
...

in the end restore all EntityPickmodes


Jack(Posted 2005) [#9]
Jfk - Right on - that looks good - but as I said I am getting a goofy location for the "child entity" in the tree.

True - I won't need it to get the next entity but I want it for other factors in the application.But I think proceeding with your idea might be good otherwise.

Thanks for the help.


Rook Zimbabwe(Posted 2005) [#10]
jfk, I didn't even think of that... good call!


Jack(Posted 2005) [#11]
More stuff the doesn't figue.

I decided to try an "one piece" x-file for the tree rather than megring 2 primitives in BB.They really came in nicely.
Tried scaling all directions at 10,7,5,3,2 etc.
When I got down to 2 --- Error counting verts.I'm not even counting the verts in the tree.Well - I wonder where that cam from.

Narrowed it down to the "X" scale.So I messed with that.
No problem if the scale is over 2.1 or under 1.9.
Just a crash in between.

Not important - I can fudge around it ( I guess) but why the heck would that happen.

By the way its not the mesh itself because this happens on 5 different meshes.????????????????????


jfk EO-11110(Posted 2005) [#12]
So you say when you scale the mesh width to 2.0, it crashes?!?

Please isolate the behaviour in a small source example and post it, thanks (does this happen with runtime-created meshes too (eg. createSphere()))?


Jack(Posted 2005) [#13]
Yes - width 2

No - not blitz created meshes nor other X models I've imported.


jfk EO-11110(Posted 2005) [#14]
What did you say, what Modeller App did you use? You may send the Model to BRL. This is really weird.


Jack(Posted 2005) [#15]
I was answering this question you asked--

quote -(does this happen with runtime-created meshes too (eg. createSphere()))?