linepick help

Blitz3D Forums/Blitz3D Programming/linepick help

(tu) sinu(Posted 2003) [#1]
im trying to parent the player to the entity beneath the player using

groundpick$ = LinePick(player1\x,player1\y,player1\z,0,-12,0)

;If groundpick = player1\PlayerPivot Or groundpick=0
;EntityParent player1\PlayerPivot,0

;Else

;EntityParent player1\PlayerPivot,groundpick

;EndIf

however when the player falls from a height with nothing below, blitz just exits, when i run it in debug, it get the message "entity cannot be parented to itself!"


Ricky Smith(Posted 2003) [#2]
First off I would ask why you are using a string variable for groundpick -

[CODE]
groundpick$ = LinePick(player1\x,player1\y,player1\z,0,-12,0)"
[/CODE]
Get rid of the dollar sign !


(tu) sinu(Posted 2003) [#3]
nope, i just put that in wrong when i was typing it up when i posted, should have been a %


fredborg(Posted 2003) [#4]
Try with something like this:
If groundpick = player1\PlayerPivot Or groundpick=0 
EntityParent player1\PlayerPivot,0 
ElseIf GetParent(player1\PlayerPivot)<>groundpick
EntityParent player1\PlayerPivot,groundpick 
EndIf



(tu) sinu(Posted 2003) [#5]
it does the exact same thing, it's a strange thing, at what point will the entity be below itself to be picked from its own position.


fredborg(Posted 2003) [#6]
Try with something like:
groundpick = LinePick(player1\x,player1\y-10,player1\z,0,-2,0)



(tu) sinu(Posted 2003) [#7]
good thinking, it works great. Probably to do with the entity moving down at a rate bigger than the distance of the linepick thus catching itself or something like that.