collision mesh vs maskedsprite

Blitz3D Forums/Blitz3D Programming/collision mesh vs maskedsprite

vivaigiochi(Posted 2006) [#1]
is it possibles?


b32(Posted 2006) [#2]
Collision are allways sphere to something. So, I don't know if it would be any good. However, you could go like this:
(1) Check for collision
(2) Read CollisionTriangle(), CollisionX/CollisionY
(3) Calculate CollisionU and CollisionV, converting Fredborgs PickedU/V example in the code archives.
http://www.blitzbasic.com/codearcs/codearcs.php?code=515
(4) Convert U/V to texture coordinates (x,y)
x# = u# * texturewidth(..)
y# = v# * textureheight(..)
(5) read pixel (x,y) from texture and check if it is the transparency color. (normally 0, 0, 0)


thelizardking(Posted 2006) [#3]
What you could do is create a cube, make its alpha=0, then scale it to the co-ordinates of the sprite, eg,

cube=CreateCube(sprite)
EntityAlpha cube,0
EntityType cube,TYPE_SPRITE

ScaleEntity cube,1,1,0.0001