EntityBox mode is driving me crazy!!

Blitz3D Forums/Blitz3D Beginners Area/EntityBox mode is driving me crazy!!

Kendo(Posted 2004) [#1]
Sorry if this question is a pain to all you professionals out there but having spent last 3 hours on this and despite having searched the forums I can't get this right!

I have created a sprite as below and created an entitybox but although I can pick the sprite it only sort of works in that there are parts of the rectangle which don't register the pick. Unfortunately the parts "not picked" appear to be random each time I run the programme. I have tried all sorts of coordinates on the entity box but none work properly.

Any guide as to what the cords should be please?

global help=CreateSprite(cam)
helptex=LoadTexture("helpparchment.jpg")
EntityTexture help,helptex
ScaleSprite help,15,10
PositionEntity help,0,8,30
entitypickmode help,3


entitybox help,-15,-10,0,30,20,1

; the sprite help has cam as parent


PowerPC603(Posted 2004) [#2]
Maybe the problem is when you create the entitybox?
Try moving the entitybox-line above the line where you move it (positionentity), to see if that solves the problem.

global help=CreateSprite(cam)
helptex=LoadTexture("helpparchment.jpg")
EntityTexture help,helptex
ScaleSprite help,15,10
entitybox help,-15,-10,0,30,20,1
entitypickmode help,3

PositionEntity help,0,8,30


I don't know if Blitz uses the 3D-world's cordinates (gobal coords) for assigning the entitybox to your entity, or the entities' local coordinates, but it could help.


DJWoodgate(Posted 2004) [#3]
Edzup reported a while back in the bug reports forum that entitybox does not follow sprite orientation correctly. If that is the case (I have not investigated it myself) you may be better of using a quad mesh (or as Edzup suggests try changing the spriteviewmode). Test this assumption by placing the sprite directly in front of the camera (when the camera is at world origin and aligned to the world axis). Presumably the box will then work as it should because the sprite will not have changed its original orientation.

http://www.blitzbasic.co.nz/Community/posts.php?topic=35178


big10p(Posted 2004) [#4]
Can't you just dump the box picking altogether if it's not working properly? Just use the polygon pick mode instead - shouldn't be slow as the sprite is only 2 tris.


Kendo(Posted 2004) [#5]
Thanks to all who responded. Apologies for not relaying results of your suggestions earlier.

PowerPC603 - your suggestion to move entitybox command above the positionentity command unfortunately did not make any difference but I am pleased you suggested it - I can't believe i hadn't thought to do it myself.

DJWoodgate - thanks to you I will remember to check the bug report forum next time. Unfortunately, changing the spriteviewmode did not make any difference. Neither did your sensible test suggestion. i think your suggested test having failed pretty much proved to me that entitybox doesn't work properly (at least with sprites).

big10p - I thought you could not pick or collide with a sprite using poly detection but had to use sphere or box detection. that's what the manual says and what, indeed, i have found in practice. Have you been able to do it?

For any and all's information - I have tried using all the premutations I can think of re the coordinates to be input into the sprite's entitybox - global, internal, changing the sprites handle. It will sort of work, but is just too hit and miss to be of any use.


big10p(Posted 2004) [#6]
big10p - I thought you could not pick or collide with a sprite using poly detection but had to use sphere or box detection. that's what the manual says and what, indeed, i have found in practice. Have you been able to do it?


Ah, well if that's what the manual says, it must be the case. Sorry, I rarely use sprites myself and don't think I've ever tried to make one pickable. I just assumed it'd work.

I think your best bet is to use a textured quad instead (as has already been suggested), and make it poly pickable. If you need the quad to always face the camera, you can PointEntity it at the camera every update. If you do this, remember to construct the quad's triangles so they are facing the right way, otherwise PointEntity will cause the quad to always be facing away from the camera. :)