[Solved] Debug EntityPick Size Like Polygon Mode

Blitz3D Forums/Blitz3D Programming/[Solved] Debug EntityPick Size Like Polygon Mode

RustyKristi(Posted 2016) [#1]
I find it weird that the entitypickmode is not precise and I can just pick a mesh around its border and it is still being picked.

Any tricks on how I can visually see the entitypick shape? In this case I'm using polygon mode.


RemiD(Posted 2016) [#2]

Any tricks on how I can visually see the entitypick shape? In this case I'm using polygon mode.


just increase the alpha of the shape (when debugging) and set its alpha to 0 (when it works well)


RustyKristi(Posted 2016) [#3]
Thanks RemiD. Actually the entitypick shape is the mesh or animated mesh itself.


RemiD(Posted 2016) [#4]
You seem to not like searching the forums for similar issues which have been asked and already answered...
So i will provide the link ! see : http://www.blitzbasic.com/Community/posts.php?topic=105302
(#3, #14)

now with the addons by Bobysait you can get the skinned vertices positions and consequently rebuild a pickable mesh with the same shape than your rigged/skinned/animated entity, but i don't recommend to do that, i suggest to use method 1 or method 2 (mentioned in post#14), it depends on what you are trying to achieve...


RustyKristi(Posted 2016) [#5]
Thanks RemiD. It's not that I like but I was looking for visual debugging and since we're in the topic of picking animated mesh, I thought this will be accurate and never thought there's some inaccuracy using default entitypick.

Though I would agree with the per limb or joint part method. It looks like a better solution in case for specific body part detection like head shots. I assume this will again hide and check before render. The only problem I'm seeing here is how to identify the mesh if I'm going to use copyentity.

If Entitypick camera,distance = rightleg_col
  mesh = GetParent(rightleg_col)



RemiD(Posted 2016) [#6]
if you try to set a rigged skinned animated mesh as a pickable and try to pick it with many linepicks, you will notice that only the tpose is considered, whatever the current animation pose.
There was a post somewhere about that but i can't find it...



I assume this will again hide and check before render


no i recommend to never hide the pickable but to have its alpha set to 0 (so that it will not be rendered)

you could also create low details bodyparts which have a similar shape than your mesh and then set them as childs (with entityparent) of the appropriate joints ("bones"), then set their alpha to 0 and use these as the pickables for this animated entity.


RemiD(Posted 2016) [#7]

The only problem I'm seeing here is how to identify the mesh if I'm going to use copyentity.


one way is to use the name of the entity to describe it properly.

Personally i put these infos in the name of an entity (if it will be involved in collisions/linepicks) :
listname-id (id is the index (for a dim arrays list) or the handle (for a custom type list))
2 examples here :
with dim arras : http://www.blitzbasic.com/codearcs/codearcs.php?code=3094
with customtype : http://www.blitzbasic.com/codearcs/codearcs.php?code=3095

search for "nameentity" and "entityname"


RustyKristi(Posted 2016) [#8]
you will notice that only the tpose is considered, whatever the current animation pose.


Is this really the case? wow that explains why there's some weird picking around the shoulder area. Do you think it would be better to use capsule type as pick meshes instead?

I did not know you can entitypick meshes with alpha = 0.


RemiD(Posted 2016) [#9]

Is this really the case?


from what i remember, yes, but try it, debug it, you will see by yourself


RustyKristi(Posted 2016) [#10]
Thanks. So I got to see that my problem is entitypick which I found out is to loose to use. It will set to true if I pick the mesh along it's Y axis which I can pick a few units (or infinity) above or below and it will still pick it.

I do think I need linepick on this one. So how do I convert it with linepick? I'm using my main camera as the starting point (entity(x),entity(y),entity(z)) and drawing a straight line at the center (entity(x),entity(y)entity(z)+100)? radius say 5-10

I can't get it to work on my first try.


RustyKristi(Posted 2016) [#11]
I settled with CameraPick with Distance Check, seems simple to do and finally I can debug it with a simple mesh.

thanks again for the help RemiD.


RemiD(Posted 2016) [#12]
TFormVector(0,0,10.0,Camera,0)
LinePick(EntityX(Camera,True),EntityY(Camera,True),EntityZ(Camera,True),TFormedX(),TFormedY(),TFormedZ())

TFormVector allows you to calculate the properties of a vector related to an entity position/orientation (in this case, the properties of the vector going from camerax,cameray,cameraz to +10.0 units on the +z axis, of the entity)
Then you can throw a linepick from entityx,entityy,entityz with the calculated vector direction/length (so in this case it will pick forward the camera from its 0z to its 10.0z)


RustyKristi(Posted 2016) [#13]
Thanks for the explanation RemiD, problem solved with also LinePick. Sometimes, the provided example in the online manual is not complete, confusing or does not provide any.

What happens when I don't set it true? ..and which is faster?

I see you also have one for TFormPoint in the archives. What is the difference and can I use it the same as linepick? I tried it replacing btw but I get no results.

Anyway, thanks Linepick also works now! :-)


RemiD(Posted 2016) [#14]
TFormPoint(0,0,10,Camera,0)
poisitionentity(3dpoint,tformedx(),tformedy(),tformedz(),true)
allows you to calculate the coordinates of a 3dpoint related to an entity position/orientation (in this case, a 3dpoint at 10.0 units on the +z axis, of the camera), it can be used if you want to determine a position related to an entity position/orientation.


RemiD(Posted 2016) [#15]

What happens when I don't set it true? ..and which is faster?


try it ! debug it ! you will see...


RustyKristi(Posted 2016) [#16]
Technically I already did with my first try which got me those issues.

Sometimes confusing when to use world = true


RemiD(Posted 2016) [#17]
the true flag is mostly to get/set the global position/orientation (in the scene world) instead of the local position/orientation (related to the parent)

in some cases it is better to use the false flag to get/set the local position/orientation of the entity (related to the parent) (in the parent world)


RustyKristi(Posted 2016) [#18]
Thanks again! For me that example explains a lot about what the command does or make it useful.