Linepick alternative.. some idea?

Blitz3D Forums/Blitz3D Programming/Linepick alternative.. some idea?

Pinete(Posted 2006) [#1]
Hi all,

I've experienced that Linepick is the slowest
function in the world.. I've observed how the game
framerate slowdown more than 25% and I would like
to change this command for another function.

I mainly use this function to position the foots of the enemies over the floor. I have aproximately 15 enemies in
the level, and the linepick function is:

Linepick(enex,eney,enez,0,-5,0)

Please, someone could point me in the right direction? What's the best way to implement a similar function?

Thanks a lot!


Matty(Posted 2006) [#2]
Use blitz's collision detection as follows:

PlayerIsOnGround=false 
For CollisionID=1 to countcollisions(PlayerEntityHandle,STATICSCENE) ;STATICSCENE = collision type assigned to your level
IF EntityCollided(PlayerEntityHandle,STATICSCENE)=CollisionEntity(PlayerEntityHandle,CollisionID) then 
If CollisionY(PlayerEntityHandle,CollisionID)<EntityY(PlayerEntityHandle) then PlayerIsOnGround=true 
endif 
next
PlayerYVelocity=PlayerYVelocity+AccelerationDueToGravity
;AccelerationDueToGravity=some negative value
IF PlayerIsOnGround=True then PlayerYVelocity=0
TranslateEntity PlayerEntityHandle,0,PlayeryVelocity,0