linepick help
Blitz3D Forums/Blitz3D Programming/linepick help
| ||
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!" |
| ||
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 ! |
| ||
nope, i just put that in wrong when i was typing it up when i posted, should have been a % |
| ||
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 |
| ||
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. |
| ||
Try with something like:groundpick = LinePick(player1\x,player1\y-10,player1\z,0,-2,0) |
| ||
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. |