Comments (10)
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.
please take a look as followed,
| rotate around this edge,
|_______
| mPlane|
| mPlane|
|_______|
|
What should i do to implement this ? thanks.
from rajawali.
I'm sorry if I fail to understand you, but isn't that what the code from my previous comment does?
from rajawali.
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.
Just to confirm, did that bit of code solve your problem? :-)
from rajawali.
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.
Could you please try to explain more elaborately what you're trying to achieve? :-) Thanks
from rajawali.
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.
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.
thanks a lot for your help!
from rajawali.
Related Issues (20)
- Seeking Luminance based desaturation
- Seeking Lighten and Darken Blend Modes
- Seeking point texture plugin
- improving SpriteSheetMaterialPlugin efficiency HOT 1
- Seeking Flexible Sprite Sheet Animation
- Seeking runtime adjustment of AlphaMask threshold
- Please restore AnimatedSpritesFragment to example app
- Stencil Buffer is not initializing corrrectly,
- Some `ScreenQuad` materials spew error messages at frame rate
- Objects starts to render with delay when camera if far from them HOT 1
- How to translate object with touch screen?
- anyway to implement ray in the library?
- Create Sphere with phiStart, phiLength, thetaStart, thetaLength HOT 1
- LoaderFBX.java:347 ArrayIndexOutOfBoundsException
- display obj model in AR
- Examples are broken
- When will the new version be released?
- load obj file fail,NumberFormatException: For input string: "nan"
- Caused by: org.rajawali3d.loader.ParsingException: Couldn't find texture ingrid HOT 1
- Why is my line3d truncated?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rajawali.