Unreliable Linepick

Blitz3D Forums/Blitz3D Programming/Unreliable Linepick

Hujiklo(Posted 2004) [#1]
Below is the code I'm using for my gun linepick. Linepick is proving everybit as unreliable as Blitz3d moving collisions in that it works on a whim...well it works about 90% of the time but what's the point if it's not 100% of the time?
Can somebody please tell me what I'm doing wrong here?
I thought line picking was pretty straight forward and reliable.
My zombies are type copies and are set to be poly picked (sphere doesn't work at all, box is about 10% accurate) - even the poly picking is crap in that I can very often just shoot near the enemies and hit them, and then if they crouch or crawl the hit rate drops to about 50/50. What on Earth is going on here? It's certainly ignoring their poly's that's for sure. Can anybody please shed light on this problem.
I've tried setting the pick radius from default right through to 1 metre...
Anybody any ideas please?

If MouseHit (1) Then
TFormVector 0,0,100000,dummy_player,0
If weapontype=1
gunhit=LinePick (EntityX(dummy_player,True),EntityY(dummy_player,True),EntityZ(dummy_player,True),TFormedX(),TFormedY(),TFormedZ(),0.05)
recoilgun#=0.01
lx#=PickedX# ly#=PickedY# lz#=PickedZ#

hitsprite(lx#,ly#,lz#)
EndIf
EndIf


Sledge(Posted 2004) [#2]
What's wrong with entitypick?


Hujiklo(Posted 2004) [#3]
Oh by the way - the lx#,ly#,lz# globals always return 0....except at startup or some reason

????? :(


Beaker(Posted 2004) [#4]
You need to put the brackets on the end:
lx#=PickedX()
ly#=PickedY()
lz#=PickedZ()

Commands (and functions) only return values if they have brackets on the end. You don't need to use them otherwise.


Sledge(Posted 2004) [#5]
No, seriously, what's wrong with entitypick? Why go to the trouble of transforming vectors for a linepick... there must be some advantage and I'm interested.


Hujiklo(Posted 2004) [#6]
Thanks for that tip Beaker - it wasn't my main worry though.
I think I've found out why it's all to pot - the problem only occurs if the zombies are crawling or crouching, yet if i shoot over their heads it registers a hit and they recoil!! It seems as if Blitz entitypickmode(poly setting) only uses the first frame from an anim mesh - it is picking the invisible first frame accurately yet ignoring the actual crouching or crawling zombie....sigh can anybody help me find an actual solution to this? Has anybody else come across this with anim meshes before?


Hujiklo(Posted 2004) [#7]
Oh sorry sledge - I meant to answer. As far as I can see with line pick I can alter the radius of the pick which could prove handy...I just tried entity pick and it does work but only with the same results - i.e. it ignores the crouch poses etc. and will only pick the original stand frame polys...sigh....


Sledge(Posted 2004) [#8]
Maintain primitive collision entities for each zombie and a look-up for where they should be for each frame?


Hujiklo(Posted 2004) [#9]
You may be right there Sledge - but it would be nice if blitz just did what it says on the box...I've been up all night again chasing my tail - this is beginning to get so frustrating - I can't realistically expect to make a decent fps if I cannot get the basics to function correctly in the first place....another worn out sigh...


Zenith(Posted 2004) [#10]
What kind of model is it? md2?

If so, MD2 does not have polygonal picking, it uses the collision sphere


Jeremy Alessi(Posted 2004) [#11]
Yeah regular .b3d models work properly as far as I know.


martonic(Posted 2004) [#12]
I've tried linepick and camerapick on animated 3ds models and in poly mode, it simply did not work. Always returned 0. Switched to elliptical pick mode and it works but in a weird way. Set the entity radius too low, and you get nothing, just zeros. Increase it a bit, and you register a hit even when you missed so long as your aim is somewhere close.

Is there any help for this? Is accurate shooting of animated enemies possible in blitz3d, perhaps with b3d models only, or is it just not possible?

If I need to convert the animated 3ds models to animated b3d format, what tools can I use to do that?

Thanks.


Neochrome(Posted 2004) [#13]
what about using the bounding Box? it worked for me, but i did use .b3d, dont know about md2, I have had many bad days with md2's!


Hujiklo(Posted 2004) [#14]
My models are all B3D...it's reassuring in away to know it's not just me getting unreliable results - I've reimported my models at least 20-30 times tweaking setting...the results are always erratic depending on the model pose.
Martonic - B3D pipeline is great for getting mdels from Max to Blitz....however once in Max I bet only your first frame of animation will be picked and all other poses ignored unless they are in roughly the same shape as the original pose.


martonic(Posted 2004) [#15]
LinePick works okay with my animated 3ds models in elliptical or in bounding box pick mode, but it does not work at all in polygon pick mode. I am testing the entity and all of its children for a match to the value returned from LinePick.


Hujiklo(Posted 2004) [#16]
I actually went and bought Nuclear Glory but the poly collision is hyper-galactically slow. I'm just using it to stop my player running through the zombies with it's solid and reliable ellipse collisions - so far no speed penalty...but polygons??Phew..they should just cut that crap right out of the dll! From 60fps to 8!!

I don't think I can get my head around coldet from what I remember.


Neochrome(Posted 2004) [#17]
what about making boxes and have them attachs to bones?

myAnimmodel = loadanimmesh("mybug.b3d")

myHead = findchild(myAnimmodel,"head")
myBody = findchild(myAnimmodel,"body")

myHeadBox = createcube(myHead)
myBodyBox = createcube(myBody)

this could be a crude way of doing that?


Jeremy Alessi(Posted 2004) [#18]
You should export your models with their pivot at the center of mass, not at their feet (that's annoying to me). Then you should have collision specific meshes for each style of animation (one standing one crawing etc...)


Dreamora(Posted 2004) [#19]
You could actually use sphere pick to see if you are near the mesh with shooting and then use a single triangle and mesh intersect to see if you actually hit


Hujiklo(Posted 2004) [#20]
Thanks for the suggestions here. They're all going into the swirling well of my poor, poor head. I'm going to have to do some sort of workaround that's for sure.
Jeremi - I also repositioned the pivot to where it should be but I still get oddly placed ellipsoids.
I did a test that made bullets stop as soon as they hit the ellipsoid of an enemy mesh - Wow! After I'd finished firing about 500 bullets, i had a shape around the enemy mesh that looked like something out of the film 'The Entity'!!! One big, ugly mess of a shape. Still trying to figure out what Bltiz is doing here.