Need some help with linepick...

Blitz3D Forums/Blitz3D Programming/Need some help with linepick...

OrcSlayer(Posted 2004) [#1]
Ok, what I am trying to do is see if a character is standing on the ground. The entity from which I am checking is a pivot placed at the characters feet, which has a collision radius of 0 (it's just for ground collision). I need to be able to do a short linepick to see if the character is standing on the ground (with at most half of the characters radius). The idea is, the character will be able to walk up surfaces until the center area (where the linepick comes from) no longer picks the ground. Then I'll start applying gravity as if the player was falling and thus prevent them from climbing further. The only problem is I'm not too savy with linepicks and I can't seem to make it pick anything (I do have the pickmode for the ground set properly). Anyone care to help?

Thanks,
-OrcSlayer


AntonyWells(Posted 2004) [#2]
Try this,

entityPickMode LevelMesh,2,true (And if you used loadAnimMesh to load your level, you'll have to set all it's children to pick mode too, unless it's a skinned .b3d, in which case picks won't work at all if it's animating too much.(Goes out of sync)

Then,
hit=linePick(entityX(myPlayer),entityY(myPlayer)+0.1,entityZ(myPlayer),0,-0.2,0)
if hit
     yInertia=0
     positionEntity myPlayer,entityX(myPlayer),pickedY(),entityZ(myPlayer))
else if yInertia>-0.2 ;Terminal Velocity, change to suit.
     yInertia=yInertia-0.02
endif


Also, be sure to use the global flag if the player is a child of anything, or you might be moving it in local space.


OrcSlayer(Posted 2004) [#3]
Hmmm, this looks exactly like what I was trying to do...except I missed a few key details, this will certainly help me out. Thanks a lot!