Sprite Question

Blitz3D Forums/Blitz3D Programming/Sprite Question

Jack(Posted 2005) [#1]
I need to have some collision detection on my sprites.It seems to me I remember seeing that they were an entiity and had collision properties.I can't seem to get them to detect when being hit.

I realize that I can make invisible cubes,spheres,etc around each one but this will be a real pain considering how many I will use.

My only other thought is to do a linepick (or something) like that and since fps is not real critical for me that would be nice if I could get a routine built that would then ignore the "black-invisible" area of the sprite if the hit is there.

Any comments or ideas???

Thanks


wizzlefish(Posted 2005) [#2]
EntityDistance


Ross C(Posted 2005) [#3]
You can only use sphere or box collision types on sprites. But, if the sprite is square in shape, entitydistance, as suggested above, will do the trick and it's pretty fast ;)


Jack(Posted 2005) [#4]
Thanks for the replies but part of my problem is that the sprites are NOT square and although perfect accuracy is not necessary I'm afraid a "box" or "sphere" around the sprite is not close enough.

So I guess you are saying a "pick" or "entity distance"
will still only work for box type collision.The invisible part of the sprite will still cause detection?

Do I have it right?

If so I guess the only thing feasible is to build something close for each tree from combining primitives?


Jack(Posted 2005) [#5]
Does anyone else have anything to add?


DJWoodgate(Posted 2005) [#6]
You could use Quads. Then you can get the uv's from the picked/hit triangle and from that the texel.


Jack(Posted 2005) [#7]
DJ - Could you give me a little more insight.

Those terms (quads,texel) are foreign to me.

The only time I can think of hearing about quads is in reference to having something like "crossing x" sprites.Is that what you are refering to?

The hit triangle I understand.

Thanks for the reply.


DJWoodgate(Posted 2005) [#8]
If you use normal triangles instead of sprites, (which are normal triangles of course except you can not get at them) you could perhaps use
http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=515 to discover the texture pixel actually hit.


Jack(Posted 2005) [#9]
Thanks DJ -
checked the link.I'll give it a try but that looks like a great deal of calculating and even though my speed is not critical this may be too much.