Pick a specific part of Ninja

Started by ani.tumanyan, March 05, 2013, 08:13:45 PM

Previous topic - Next topic

ani.tumanyan

Hi everybody,

I'm trying to rotate specific parts of Ninja object. So I need to determine the specific bone the user has picked by touching on some part of the screen. Using collision detection technique I can understand which object was picked, but that's not enough as this returns only the whole object (the Ninja).

So my question here is,  how to know which bone was selected by a touch event?


Thanks in advance!
Ani

raft

if you know vertex index, you can query which bones (joints) effect that vertex as below:

short[] indices = animated3D.getSkinData().getJointIndices(vertexIndex);
float[] weights = animated3D.getSkinData().getWeights(vertexIndex);


now, indices points which joints effect that vertex and weights points how much each joint effect that vertex*

accesing vertex index is another story. AFAIK there is no direct way of it. using a CollisionListener and retrieving polygons id's from CollisionEvent and reverse querying IVertexController.getPolygonIDs for each vertex for matching polygons may help. Egon may clarify this.

* SkinData was not exposed before, I've just added a method to Animated3D to get SkinData. so re-download Bones. also note, Animated3D.getSkinData() and SkinData.getXX() always returns a copy, so caching them makes sense.