Git Product home page Git Product logo

Comments (10)

MasDennis avatar MasDennis commented on July 20, 2024

It's very hard to understand what you're trying to achieve but is this what you're looking for?

public class UIExampleRenderer extends RajawaliRenderer {
    private Plane mPlane, mChildPlane;
    private Animation3D mAnimation3D, mChildAnimation3D;
    public UIExampleRenderer(Context context) {
        super(context);
        setFrameRate(60);
    }
    
    protected void initScene() {
        mCamera.setZ(-10);
        
        SimpleMaterial planeMat = new SimpleMaterial();
        Bitmap texture = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.rajawali_tex);
        planeMat.addTexture(mTextureManager.addTexture(texture));
        float h = 8*MathUtil.tan(45 / 360.0f * MathUtil.PI);
        float w = ((float)texture.getWidth()/texture.getHeight())*h;
        mPlane = new Plane(h,w,1,1);
//      mPlane.setRotZ(-90);
        mPlane.rotateAround(new Number3D(0, 0, 1), -90, true);// to show a image right.
        mPlane.setMaterial(planeMat);
        mPlane.setColor(0x55ffffff);
        addChild(mPlane);
        
        mChildPlane = new Plane(h, w, 1, 1);
        SimpleMaterial mat = new SimpleMaterial();
        mat.setUseColor(true);
        mChildPlane.setMaterial(mat);
        mChildPlane.setColor(0xff00ff00);
        mChildPlane.setX(w / 2);
        mChildPlane.setDoubleSided(true);
        mPlane.addChild(mChildPlane);
        
        mPlane.addChild(mChildPlane);
        
        Number3D axis = new Number3D(0, 0, 1);
        axis.normalize();
        
        mAnimation3D = new RotateAnimation3D(axis, 0, 360);//  the mPlane will rotZ 90 first, then start the animation.
        mAnimation3D.setDuration(2000);
        mAnimation3D.setTransformable3D(mPlane);
        
        mChildAnimation3D = new RotateAnimation3D(Axis.Y, 360);
        mChildAnimation3D.setDuration(2000);
        mChildAnimation3D.setTransformable3D(mChildPlane);
    }
    
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        super.onSurfaceCreated(gl, config);
        
        mAnimation3D.start();
        mChildAnimation3D.start();
    }
    
    public void onDrawFrame(GL10 glUnused) {
        super.onDrawFrame(glUnused);
    }
}

from rajawali.

sunfred avatar sunfred commented on July 20, 2024

please take a look as followed,

| rotate around this edge,
|_______
| mPlane|
| mPlane|
|_______|
|

What should i do to implement this ? thanks.

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

I'm sorry if I fail to understand you, but isn't that what the code from my previous comment does?

from rajawali.

sunfred avatar sunfred commented on July 20, 2024

Thanks a lot for help.

At 2012-06-14 18:15:30,"Dennis Ippel" [email protected] wrote:

I'm sorry if I fail to understand you, but isn't that what the code from my previous comment does?


Reply to this email directly or view it on GitHub:
#62 (comment)

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

Just to confirm, did that bit of code solve your problem? :-)

from rajawali.

sunfred avatar sunfred commented on July 20, 2024

no, not what i want.

Dennis Ippel [email protected]编写:

Just to confirm, did that bit of code solve your problem? :-)


Reply to this email directly or view it on GitHub:
#62 (comment)

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

Could you please try to explain more elaborately what you're trying to achieve? :-) Thanks

from rajawali.

sunfred avatar sunfred commented on July 20, 2024

i want to draw a rectangle, and let the rectangle rotate around one of it's edge. you can see the attachment.

At 2012-06-15 15:59:54,"Dennis Ippel" [email protected] wrote:

Could you please try to explain more elaborately what you're trying to achieve? :-) Thanks


Reply to this email directly or view it on GitHub:
#62 (comment)

from rajawali.

MasDennis avatar MasDennis commented on July 20, 2024

Ah ... now I get it :O
The easiest way is to create an empty BaseObject3D and add your plane as a child. Then rotate the empty BaseObject3D:

BaseObject3D empty = new BaseObject3D();
Plane plane = new Plane(w,h,1,1);
plane.setX(-w);
empty.addChild(plane);

// ... now rotate the empty around its y axis

from rajawali.

sunfred avatar sunfred commented on July 20, 2024

thanks a lot for your help!

from rajawali.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.