LinePick for Dummies?

Blitz3D Forums/Blitz3D Beginners Area/LinePick for Dummies?

_PJ_(Posted 2005) [#1]
Please help, I want to get the hang of LinePick in my program. I am trying to use it for seeing whether or not the Lens Flares should appear.

I have a Camera (cam) - Camera
a Spaceship (ship) - mesh
and the star(star) - sprite
plus some Lens Flares (Flare1, Flare2 etc) - Sprites.

I have set the ship to be EntityPickMode 2

now I just neeed to understand the use of the coordinates. The second set of values to be precise, do they respond to a vector, outlining the direction of the imaginary 'line' used for picking? How can I just check for a straight line from the centre of the camera viewport?

Sorry, but Im having a complete mind-blank today (got a cold *sniff*!)


Stevie G(Posted 2005) [#2]
The second set of coords for linepick do indeed relate to a vector rather than a position. Something like this should work ..


tformvector 0,0,100, Camera, 0

linepick entityx(camera), entityy(camera), entityz( camera ) , tformedx(), tformedy(), tformedz()


Stevie


_PJ_(Posted 2005) [#3]
Thanks for that, I can understand the principle, but in practice, it still eludes me. Du to the way the camera woirks, the ship will always be in front of the camera, but not necesarily in line with the star as well.

I tried this, but it doesn't work.

TFormVector 0,0,1000,Cam,star
picked=LinePick (EntityX(cam), EntityY(cam), EntityZ( cam ) , TFormedX(), TFormedY(), TFormedZ() )
If picked=ship And EntityPick(ship,100)=star
	HideEntity corona
	HideEntity Flare1
	HideEntity Flare2
	HideEntity Flare3
EndIf



Ross C(Posted 2005) [#4]
Best not to use linepick for this i say. Why not, entity in view and a entity visible call?


_PJ_(Posted 2005) [#5]
:)

EntityVisible works much better! Thanks, Ross.

Just one more quick question, considering I am using Sprites, how can I affect the size of the 'Star' for purposes of determining whether it is obscured or not?


t3K|Mac(Posted 2005) [#6]
but if an object is hidden by another object, entityvisible won't work. at least it doesn't for me.


Ross C(Posted 2005) [#7]
You need to set pickmodes for the other entities ;o)


Ross C(Posted 2005) [#8]
Entityvisible i believe uses a bounding box, so you would need to scale the sprite.


t3K|Mac(Posted 2005) [#9]
entityvisible uses bounding box if entity is a mesh, but if you have another entity in front of it (and big enough to cover the other entity and its mesh) entityvisible returns true. but this is wrong, it is NOT visible at that moment. thats why fredborg did a nice routine for this case.


Ross C(Posted 2005) [#10]
If the other entity has an entitypickmode obsurer though, it shouldn't. I used this for my sun glow code and it works


Ross C(Posted 2005) [#11]
http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPickMode&ref=3d_a-z

The optional parameter in EntityPickMode.


_PJ_(Posted 2005) [#12]
Please note that only Sphere and Box picking will work with Blitz3D sprites. For polygon picking, you will need a valid mesh