linepick doesn't work with anim meshes...?????

Blitz3D Forums/Blitz3D Programming/linepick doesn't work with anim meshes...?????

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

I've noticed recently that the command linepick fails with
animated entities.
I'm not sure if the is a isolated phenomena that only has happened to me or someone more have experience it.

Basically I load an animated mesh, not much animations, just
the tipical ones... walk, run, open fire and crouch and set all its childs as pickables.

The problem comes when the enemy detects you (player) and crouch itselg (one of the states of its behaviour). When I tried to point him I noticed that the target only turned in red (it happens when you are pointing to a enemy) pointing some of the parts of the body, and, the most strange thing,
the target turned in red when I pointed out of the body
of the enemy, just in the closest upper pixels.

I have concluded that linepick command was picking the
"base entity", is said, the base state of the mesh: static.

Some days ago I posted my doubts about how to make 100% pickable a mesh and octothorpe give me a code snipet, very basic, to make it.

I load the mesh and make all the childs pickables... I guess there cannot exist any error...

some idea about how to solve this??

Thanks in advance!


jfk EO-11110(Posted 2006) [#2]
It's true, Linepicks will use the initial pose of the animated mesh, not the current animation pose. This is a problem with .B3D only. There isn't much you can do AFAIK, other than using .3DS or .X instead.


Pinete(Posted 2006) [#3]
Thanks!
Do you know if occurs the same with other blitz similar commands like meshintersect()???
Just to think in possible alternatives!

Regards!


Beaker(Posted 2006) [#4]
There are solutions to the problem tho. You could use pickable spheres positioned relative to the bones for example.

Using 3DS or X isn't really a solution, as then you don't get nice skinned animations.


Matty(Posted 2006) [#5]
Another method which I outlined in an older thread is to do this: (mainly for detecting bullets hitting different body locations on any mesh md2 or b3d)

place camera at the position you wish to do the linepick from, point it at your entity along the same direction as the direction you wish to linepick from.
Set the entity color of all objects you wish to treat as possible barriers to the linepick in one color and your target entity in another color. Take a render at low res with the new camera. Do a readpixelfast at the centre of the viewport for that camera, by comparing colors you can tell what object you have hit and what location. For example if you wanted to detect bullet hits on arms/legs/head you simply create a second texture for your creature with those areas color coded, and then check what color was returned from the camera render.


jhocking(Posted 2006) [#6]
I use hitboxes. Essentially Beaker's suggestion, except I use boxes, not spheres. Basically, make a bunch of rectangular primitives for each bone and parent them to the bones.


Pinete(Posted 2006) [#7]
...and what about meshintersect? could be helpful? or it has the same behaviour with anim meshes?

regards!


jfk EO-11110(Posted 2006) [#8]
I just made a test, it seems meshesintersect also works this limited way. It's really one of the not so fatastic aspects of the format, but I guess there are technical reasons for it.


jhocking(Posted 2006) [#9]
It's for the same reason that TFormPoint doesn't return the position of animated vertices. Mesh deformation for skeletal animation is handled on the video card, so it would be too slow to send the data back up the pipe to the CPU.


Ross C(Posted 2006) [#10]
I thought it was a software based deformation. I'm pretty sure the transformations are software, that's why there so bleeding slow.


Gabriel(Posted 2006) [#11]
Well it's not done with a vertex shader, but I'm not sure if it's done on the videocard despite that. In either case, Blitz doesn't ( for whatever reason ) keep track of the vertex positions with skeletal animation so none of these commands are going to be able to retrieve the vertex position during an animation. Bone positions are updated during the process though, so you could probably code it yourself. It's gonna be horribly slow though ( more so ) and hardly any ( even commercial ) games actually do hit detection by the vertex.


Ross C(Posted 2006) [#12]
There's a .DLL by spacemonkey. He's claiming it does massive tform operations, and it may be quick enough to calculate vertex positions :o) It's in the creation part of the forum.