Entity Pick Mode and Animations

Blitz3D Forums/Blitz3D Programming/Entity Pick Mode and Animations

LostCargo(Posted 2003) [#1]
Okay here is the deal.
I have a mesh that is animated. I set its pick mode to polygon. When the mesh is animated, only the area that the first frame of the animation was, will actually raise the 'pick' event, and return an entity handle.

So how do i overcome this issue if i want to be able to select a mesh if lets say, frame 1 is the character standing, and frame 20 is them lying on the ground?


_PJ_(Posted 2003) [#2]
Im only ghuessing, but maybe re-setting the Pickmode for each animation frame?


jhocking(Posted 2003) [#3]
Hm, this is an interesting problem. I assume you are referring to a skeletal animated model. For a variety of functions only the first frame registers because Blitz does not keep track of vertex deformations except immediately before rendering.

Maybe you need to use a proxy object (set invisible with EntityAlpha) for detecting picks while lying down.


LostCargo(Posted 2003) [#4]
True. and a valid ideas. Thanks guys. UNfortunately im still in the same boat. Im just glad my game isnt relying heavily on heavy mesh animations.


BLaBZ(Posted 2012) [#5]
Any solutions to this?


RemiD(Posted 2012) [#6]
Maybe you can create cubes or cylinders with a shape similar to the body parts of your character, and attach the cubes/cylinders to the joints of your skeleton.

When you want to use linepick, you show the meshes, when you don't want to use linepick, you hide the meshes. I think this should work, this is not really precise but it will be more precise than a random pose of an animation.


BLaBZ(Posted 2012) [#7]
Yeahh, thats a good way to hack it though I was looking for something a little more proper


Yasha(Posted 2012) [#8]
That is the "proper" way - separating your concerns across different systems. There is simply no reason to use the rendered mesh for pick detection.

Using the same data for rendering and collision/picking is much more "hackish", and even if there was an obvious way to do it (besides creating your own vertex animation system, which is certainly possible but kinda overkill), it would necessarily be slower and less useful, because it has to process all the fine rendered details that you simply don't need or want for collision detection.


BLaBZ(Posted 2012) [#9]
Right, Initially it seems like a limitation, something that should be handled but I understand why its not


Adam Novagen(Posted 2012) [#10]
Seconding the suggestion put forth in this thread. The only reason such a suggestion should be "improper" is if you used an obscene number of primitives for the picking, or if they had a ridiculous number of polygons. Basically, it's just a simple "hitbox" principle, and even Valve uses a system like this for similar scenarios such as multiplayer shooting.


stayne(Posted 2012) [#11]
I never had this issue and I have worked with a lot of animated models. I always did it like this (from memory):

Type model
  Field mesh
  Field picked
End Type

m.model = New model
m\mesh = LoadAnimMesh blah blah
EntityPickMode m\mesh,2

While Not KeyDown(1) ;Main Loop

  If MouseHit(1) = True
    pick = CameraPick(MouseX(),MouseY())
      For m.model = Each model
        If m\mesh = PickedEntity()
          m\picked = True
        Else
          m\picked = False
        EndIf
      Next
  EndIf

  For m.model = Each model
    If m\picked = True
      ;Do Stuff
    Endif
  Next

Wend
End



Ross C(Posted 2012) [#12]
The problem is the polygon detection is only from the first frame of animation. If you had something that move position within the animation frames, you will still be detecting the polgyons positions from the first frame.

And this only applies to .b3d boned animations. And hopefully I will be back on track and email you tonight!