Animate rigged model according to given commands

Started by aeroxr1, June 05, 2014, 10:14:22 PM

Previous topic - Next topic

aeroxr1

Where do you suggest to create the model ?

in the onSurfaceCreated function ? Or is better if I create the model in an other function ? :)

raft

doesnt really matter at this stage of the project. you can load them in any thread and anytime


aeroxr1

Hi :)
why I have to put the bones file in the animatedgroup and not in animate3d ?

(i watched ninja bones android demo)

Quote
masterNinja = BonesIO.loadGroup(res.openRawResource(R.raw.ninja));

And why the texture is applicate in this for function ?

for (Animated3D a : masterNinja)
a.setTexture("ninja");


If I have only one bones file with only one 3d model , do I have to do  same thing ?

raft

yes, you should do the same thing.

if you will always have one object in your group, you can use BonesIO methods to save a single object. but personally I dont see any point in that

aeroxr1

#50
I set the camera in this way :


cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(new SimpleVector(0, -box_h/2, box_h));

protected float[] calcBoundingBox() {
float[] box = null;

for (Animated3D skin : modello) {
float[] skinBB = skin.getMesh().getBoundingBox();

if (box == null) {
box = skinBB;
} else {
// x
box[0] = Math.min(box[0], skinBB[0]);
box[1] = Math.max(box[1], skinBB[1]);
// y
box[2] = Math.min(box[2], skinBB[2]);
box[3] = Math.max(box[3], skinBB[3]);
// z
box[4] = Math.min(box[4], skinBB[4]);
box[5] = Math.max(box[5], skinBB[5]);
}
}
return box;
}


and the result is :


it isn't as I wanted  :(

I would set the camera in front of the model :( Where did I wrong ?

And I have seen helloworld and other jpct-ae's examples and in all of those the world is created in onSurfaceChange; it works but how ? Does Onsurfacechange runs only when the display is rotated ?

And another things, is there a function to scale the model in landscape mode ? I mean when I rotate the display from portrait to landscape mode the human model has to become little :D

raft

just move the camera to other part of model. or rotate the model.

you can move camera closer to make the model look bigger. or you can scale the model.

onSurfaceChanged is called every time the surface is created. just read the docs:)

aeroxr1

Quote from: raft on September 06, 2014, 06:51:53 PM
just move the camera to other part of model. or rotate the model.

you can move camera closer to make the model look bigger. or you can scale the model.

onSurfaceChanged is called every time the surface is created. just read the docs:)


QuoteCalled when the surface changed size.

Called after the surface is created and whenever the OpenGL ES surface size changes.

Typically you will set your viewport here. If your camera is fixed then you could also set your projection matrix here

I didn't see this line -.-"""" sorry  ::)

Another stupid question :
when I import a new model, in what position will be place ? 0,0,0 ? :D
I imagine is very stupid question, but I know little of 3d graphics -.-"



raft

yes, it will be in origin (0,0,0) in world space.

but that does not necessarily means you will see your model in origin. that depends on the model position when it's exported

aeroxr1

All the object after the inserting is positionated in 0,0,0 ?

For example when I use getcamera() the camera initially is in 0,0,0 ?

I try to ask :D :
Is there an example where the model is scaled when the smartphone is rotated from portrait to landscape view ? :D

Now I'm trying to experiment with direction,simplevector and rotation matrix  ;D

raft

yes everything is initially at origin until you move them to somewhere

Quote from: aeroxr1 on September 06, 2014, 09:45:21 PM
Is there an example where the model is scaled when the smartphone is rotated from portrait to landscape view ? :D

possibly there is somewhere in the forum. just try different scaling values.

it's also possible to make the model occupy same height of the screen by adjusting camera distance. have a look at AbstractSkinSample.autoAdjustCamera method

aeroxr1


raft

yes, i know, thx. my hosting company says my server is DDOS attacked ???

aeroxr1

#58
Do Hacker wants to obtain your private images ? xD
Now I'm trying to understand the rotation matrix to applied it to the arms , I want they lies along the body :)
( I want to set the position of model's arms via programmatically )

aeroxr1

#59
I searched into the web, but I didn't found an explanation of the use of matrix bindpose , matrix inverse bind pose and the relation between them.

EDIT : I found this explanation http://www.gamedev.net/topic/571044-skeletal-animation-bonespace/ . It is wrong ?

But remain this doubts :

        final Matrix jointInverseBindPose = pose.getSkeleton().getJoint(jointIndex).getInverseBindPose();
        final Matrix jointBindPose = jointInverseBindPose.invert();


jointInverseBindPose ok, now , maybe I understand whats is it.
But why do we do this : jointBindPose =  jointBindPose = jointInverseBindPose.invert(); ?
in the precedent link this thing there isn't .. :(


Other parts of code that I don't really understand are :
        // Get a vector representing forward direction in neck space, use inverse to take from world -> neck space.
        SimpleVector forwardDirection = new SimpleVector(bindPoseDirection);
        forwardDirection.rotate(jointInverseBindPose);

        // Get a vector representing a direction to target point in neck space.
        SimpleVector targetDirection = targetPos.calcSub(pose.getGlobal(jointIndex).getTranslation()).normalize();
        targetDirection.rotate(jointInverseBindPose);



in particular why do we use jointinversebindpose to rotate the forwarDirection and the targetdirection ? to take from world to neck space don't we need to multiply vector to jointinversebindpose ?

And I don't understand this : pose.getGlobal(jointIndex).getTranslation()

Can you give me a hand ?