Using LinePick

Blitz3D Forums/Blitz3D Programming/Using LinePick

angel martinez(Posted 2006) [#1]
What is the best way to use LinePick instructions to detect only some objects(with entitypickmode for sphere) and not scenery(entitypickmode for polys)? Because I want the weapon-sight to detect only the pickable enemy entities and not the scenery in order to change the color of the crosshair-target.
Perhaps the only way is to use a flag to identify the enemy-entities but...


DJWoodgate(Posted 2006) [#2]
Turn off picking for the objects you do not want to pick?


angel martinez(Posted 2006) [#3]
Yes, but I need to pick the scenery for other things in the game and I need to assign it the entitypickmode for polys...


Beaker(Posted 2006) [#4]
You can turn picking on/off on the fly as you need it. You don't need to rely on UpdateWorld as you would for collisions.


Ross C(Posted 2006) [#5]
Why not parent all your scenary pieces to a pivot, and all your enemies to a pivot. When testing the linepick against enemies, hide your pivot, which will hide everything parented to it. Obviously show the pivot again before rendering. Same with testing against the scenary.


Sir Gak(Posted 2006) [#6]
Maybe you could use the EntityType command in conjunction with the LinePick? Just make enemies one kind of EntityType, and scenery objects another (you have a range of 1 to 999 for EntityType assignments). Then, when running LinePick, check also the EntityType.
The LinePicks you want to shoot/attack, should have one kind of EntityType assigned, whereas other things you want to LinePick for reasons other than combat, assign a different EntityType. Combining commands can give you a broad spectrum of possibilities, including enemies than can be attacked by one kind of weapon, but are unaffected by another, etc.


Ross C(Posted 2006) [#7]
I don't think you can find an entity's type, just from it's mesh handle. Hiding them would probably be the easiest solution here i think.


Matty(Posted 2006) [#8]
alternatively keep a list ( like a type or bank) which contains the default pick mode/type for each entity. Also store the entity handle. Assign each entry in the list a class like 'creature' 'world' 'item', and then before performing a pick set the pick mode to any objects of a particular class to zero (the ones you don't want to pick) and then after the linepick restore the pickmodes to their default in the list.


Sir Gak(Posted 2006) [#9]
Ross C: The mesh handle uniquely describes which entity you have picked, right? Then you would use the GetEntityType ( entity ) command, which returns the collision type of an entity as set by the EntityType command. So, yes, you could.

Matty: The is an excellent alternative idea, which wil also work, but I would go for the use of a Type, rather than a Bank.


Ross C(Posted 2006) [#10]
AH, i get what your saying now :o)

But, hiding the pivots as i suggested would be the quickiest and the easiest method i would say.


Sir Gak(Posted 2006) [#11]
Well, I see what you're saying about hiding the pivot. I wonder, though, if, by linking all movable entities to just one pivot, if that will produce a performance hit, especially as the number of children attached to that pivot grows. Ditto, the scenary. The method I suggsted not only works on an individual entity basis, but allows for fantastic variations, what with each entity being able to have an EntityType range of 1 to 999. Hmm, come to think of it, you'd have to set Collisions for each EntityType you create, if collisions are to be tested for that one. Talk about a possible performance hit. I guess tha's the beauty of different algorthms. Multiple ways to accomplish the same goal. The one you pick to use is up to you with regard to the purpose(s) you have in mind.


Ross C(Posted 2006) [#12]
Yeah, that's true :o) There's no real performance hit for parenting meshes. And hiding them is super quick.

That's the good thing about community's. You get lots of different suggestions and ideas :o)

(mines is the best though!)

*runs away laughing*