jPCT-AE - a 3d engine for Android > Support

Animation problem

(1/5) > >>

Zemalax:
Hello!
I have a problem. There is an animated object (spinning cube) in the format .3 DS, I'm trying to run the animation, but it does not move.

The place where I load the model:

--- Code: ---Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.art)),128, 128));

TextureManager.getInstance().addTexture("texture", texture);

Resources res = getResources();

test = Object3D.mergeAll(Loader.load3DS(res.openRawResource(R.raw.animcube),1.0f));

test.setTexture("texture");

test.calcNormals();
test.build();
world.addObject(test);


--- End code ---


The place where I animate:


--- Code: ---public void doAnim() {
{
ind += 0.02f;
if (ind > 1f) {
ind -= 1f;
}
}
test.animate(ind);
}

--- End code ---

The place where I run animate:


--- Code: ---public void onDrawFrame(GL10 gl) {
doAnim();
...

--- End code ---
(ind - float)
It's just an animated model, I can not get it to perform motion.
Help pls

EgonOlsen:
Animated in this case means that it's animated in 3ds? If that is the case...jPCT-AE doesn't load this kind of animations. I'm not even sure that the 3ds format actually supports them. If you want to rotate a cube, you have to do it in code. Scrap that animation code and replace it with a test.rotateY(0.01f); instead.

Zemalax:
And what format is well suited to animation?

EgonOlsen:
jPCT supports keyframe animation by default and skeletal animations when adding the Bones library to it (see the Bones forum section for more information). A rotation should never be done as a keyframe animation nor as a skeletal one. It should be done by applying a rotation to the object. For keyframe animations, the easiest (but limited) way is to export to md2 format. Another option is to load the keyframes as separate 3ds or obj files...you should be able to find some information about that in the forum.

Edit: The most powerful and flexible way is to use Bones though.

Zemalax:
And if I make a few frames of animation (keyframes), then animate the transition from one frame to another will be smooth? (That is, the object will not jump?)

Navigation

[0] Message Index

[#] Next page

Go to full version