Rajawali Tutorial 13: Animation classes

Posted by on Mar 26, 2012 in 3D, Android, Rajawali15 comments

This tutorial has moved to the [Rajawali Wiki](https://github.com/MasDennis/Rajawali/wiki/Tutorial-13-Animation-Classes).



Tags: , , , ,


15 comments

» Comments RSS Feed
  1. Do you have any screenshots to describe it work?

  2. Hi Troung,
    You can download the examples app to see it in action: https://play.google.com/store/apps/details?id=com.monyetmabuk.rajawali.tutorials

  3. Hi, Dennis. Can you tell me can i use the sprites in your engine and how, if it real.

  4. Hi Yuri,
    What do you mean exactly? Point sprites?

  5. no, just frame-animated textures

  6. [...] Rajawali Tutorial 13: Animation classes [...]

  7. Good one. It’s not part of the framework yet but I’ll put it on the to do list :-)

  8. Hi Dennis, I’ve been playing with your framework all week and I’m having a blast. Good work!

    Question: is it possible to queue up a rotation and a translation at the same time? I have a sphere and I want to rotate it so it looks like it is rolling at the same time as it is moving across the screen.

  9. Ah, Dennis… I figured out I could create two separate animations and start() each of them individually and they’ll both go at the same time.

    Awesome.

  10. Glad you solved it! :)

  11. Hi Dennis. I have a strange issue with RotateAnimation3D. With your .obj model everything is OK. But when i use own model and run RotateAnimation3D animation – object isn’t rotating around its axis, it’s rotating around camera. Can you help me?

  12. I fixed this! :) Object’s origin was wrong, fixed it in Blender and now animation works correct!

  13. Dennis, your engine is awesome! :D

    There is one thing I haven’t figured out yet.
    In this animation example you use axis.normalize() with rotation animation. What does that do exactly? I don’t see any difference if I leave that out.

  14. 1. Amazing work Dennis!!

    2. Question: at the moment you can’t pause and resume animations. I want to add this functionality (for live wallpapers its nice to see them continue exactly where they stopped). I just had my first look at the source code and from my first impression I could add the pause2() and resume2() methods to animation3d by introducing an offset, which would be (resumetime-pausetime) and then incorporating this offset to compute “millis” in UpdateTimeTask.run(). Does this look plausible?

  15. Hi, i have created the following BaseObject3D object to mimic an image cube where each cube-face is a different image.

    I implemented this because i could not make work the skybox cube. It always looked like being viewed from inside the cube, not outside as i want.

    The class i have created is the following one, in a few words, it is a group of 6 planes with some rotations to create the cube FX. The problem arise when i do a rotation on the cube and it’s not centered, it do the rotation always using the axis (0,0,0)… i dont know what is happening, i need help

    import java.util.ArrayList;
    import java.util.List;

    import org.pol.cubethemegenericx2lw.renderer.CubeThemeGenericX2Renderer;

    import rajawali.materials.SimpleMaterial;
    import rajawali.materials.TextureInfo;
    import rajawali.primitives.Plane;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;

    public class CubeBitmap extends Abstract3DObject {

    private CubeThemeGenericX2Renderer renderer;
    private float size;
    private float x;
    private float y;
    private float z;

    public List carasCubo;

    public CubeBitmap(CubeThemeGenericX2Renderer renderer, float x, float y, float z, float size, int resourceId1, int resourceId2, int resourceId3, int resourceId4, int resourceId5, int resourceId6) {

    carasCubo = new ArrayList();

    this.renderer = renderer;
    this.size = size;
    this.x = x;
    this.y = y;
    this.z = z;

    setPosition(x, y, z);

    Plane plano1 = agregarPlano(resourceId1, x, y, z – (size / 2f));
    plano1.setRotation(0, 0, -90);

    Plane plano2 = agregarPlano(resourceId2, x, y, z + (size / 2f));
    plano2.setRotation(0, 180, 0);

    Plane plano3 = agregarPlano(resourceId3, x – (size / 2f), y , z);
    plano3.setRotation(0, 90, 0);

    Plane plano4 = agregarPlano(resourceId4, x + (size / 2f), y , z);
    plano4.setRotation(0, -90, 0);

    Plane plano5 = agregarPlano(resourceId5, x, y – (size / 2f), z);
    plano5.setRotation(90, 0, 0);

    Plane plano6 = agregarPlano(resourceId6, x, y + (size / 2f), z);
    plano6.setRotation(-90, 0, 0);

    }

    private Plane agregarPlano(int resourceId, float planeX, float planeY, float planeZ) {

    Plane plane = new Plane(size, size, 1, 1);
    plane.setPosition(planeX, planeY, planeZ);

    Bitmap bitmap = BitmapFactory.decodeStream(renderer.getContext().getResources().openRawResource(resourceId));
    TextureInfo tInfo = renderer.getTextureManager().addTexture(bitmap);

    SimpleMaterial material = new SimpleMaterial();
    material.addTexture(tInfo);

    plane.setMaterial(material);

    addChild(plane);
    carasCubo.add(plane);

    return plane;
    }
    }

Leave a comment