Strange "Linepick" situation

Blitz3D Forums/Blitz3D Programming/Strange "Linepick" situation

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Jack - Local Z Direction or Global Z Direction? (ie character or object's forwards direction or the world's forwards direction)

If you want to check for an object using linepick in the 'local z direction' then you will need to use the TformVector commands to transform the entity's space to the world space.

As an example, if I were to have a character that I wanted to test for an object that is directly in front of it (local space) then I would do this:

LocalX#=0
LocalY#=0
LocalZ#=some number for how far in front you wish to check..

TFormVector LocalX,LocalY,LocalZ,CharacterEntity,0
;the above line takes a vector and transforms it from your character's local space to the world space (or global coordinates)

objectihit=linepick EntityX(CharacterEntity),EntityY(CharacterEntity),EntityZ(CharacterEntity),TFormedX(),TFormedY(),TFormedZ()
;this performs a linepick directly forwards from the character's point of view.

;put the rest of your code here as normal...



Note though that (in my experience) linepicks are often slow and wherever you can get away without them the better