LinePick for Dummies?
Blitz3D Forums/Blitz3D Beginners Area/LinePick for Dummies?
| ||
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*!) |
| ||
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 |
| ||
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 |
| ||
Best not to use linepick for this i say. Why not, entity in view and a entity visible call? |
| ||
:) 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? |
| ||
but if an object is hidden by another object, entityvisible won't work. at least it doesn't for me. |
| ||
You need to set pickmodes for the other entities ;o) |
| ||
Entityvisible i believe uses a bounding box, so you would need to scale the sprite. |
| ||
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. |
| ||
If the other entity has an entitypickmode obsurer though, it shouldn't. I used this for my sun glow code and it works |
| ||
http://www.blitzbasic.com/b3ddocs/command.php?name=EntityPickMode&ref=3d_a-z The optional parameter in EntityPickMode. |
| ||
Please note that only Sphere and Box picking will work with Blitz3D sprites. For polygon picking, you will need a valid mesh |