Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - tomoroho

#1
Quote from: EgonOlsen on September 14, 2012, 11:29:12 AM
As mentioned earlier in this thread, try to set two dummy Object3Ds at the position of the pivots, assign them both as parents to the actual object and apply the rotations to them instead. You might have to adjust Config.maxParentObjects for this.
awesome.Thanks very much ,egon.
Seems I misunderstood your meaning earlier.
#2
Support / Re: transparent objects depth?
September 14, 2012, 11:46:40 AM
Quote from: EgonOlsen on September 14, 2012, 11:22:08 AM
With setCulling, you are setting the backface calling. It has nothing to do with camera calling. Maybe the vertex order of the number meshes is just wrong. That would explain the darker look without backface culling too, because the normals used for the lighting calculations would be pointing away from the camera. Try to leave calling enabled but call invert() on the numbers before calling build() to see if that helps.
works well,and I know why it occurs.It's very awesome.
thank you very much.
#3
Support / Re: transparent objects depth?
September 14, 2012, 10:18:01 AM
Quote from: EgonOlsen on September 14, 2012, 09:33:13 AM
Calling happens based on the actual position. It's not affected by the sort offset. Anyway, i don't really understand your description...do you have a screen shot?
as the image below showing:

when all object set culling disable,it displays like what the image showing.
And when not set,the number "08 00 " is invisible.And they're just in front of the panel with a much lower sortoffset.
#4
Support / Re: transparent objects depth?
September 13, 2012, 06:27:18 PM
Quote from: EgonOlsen on September 11, 2012, 09:06:38 PM
If A should always be in front of B, give A a very low negative offset like -100000. If these objects are the only ones that are transparent in the scene, you can give B a very offset instead too.
yep.it works. Finally I make the showing of different lays of transparent object stably through this method,though it's a little
trivial because there is tens of objects.
But there is a weird problem during this,Object A is invisible though its sortoffset is smaller than (>10000)Object B. I set the both
objects with the method setCullingenable(false). Then A is visible but it's not what it supposed to be , It looks like being seen through from object B. How the culling happens, object A is not outside the camera space and the sortoffset makes it in front of object B.
Thank you very much.
#5
Quote from: EgonOlsen on September 11, 2012, 09:19:15 PM
That is still caused by fact that the pivot is not cumulative. Your second change to it has an influence on your former rotation around z. However, the x value of the pivot has no influence on rotations around x and the z value not on rotations around z. So why don't you set it to -10,0,-10 and leave it there?
In my project , the tow pivot are two object's position. Their center vector are(0.0012594461 , -0.0044493526 , 2.6102736) and(7.7617483 , -14.186078 ,3.4127176). I can't merge them into one pivot,otherwise the animation will not what i want. In the above code , I just set two random different pivots by adding
certain value on the transformcenter at the beginning of animation. Can it be fixed in the condition that the two pivots are not cumulative? Or there is another way to
do the animation effect i want.
thank you very much.
#6
Support / Re: Problem with rotating a box.
September 11, 2012, 06:23:42 PM
1. u should add texture to manager before loadobj,that means the code below should places before loading obj file.
InputStream is = getResources().openRawResource(R.drawable.grid);
Bitmap bitmap  = BitmapFactory.decodeStream(is);
Texture texture = new Texture(bitmap);
TextureManager.getInstance().addTexture("texture", texture);

for detail,see to http://www.jpct.net/wiki/index.php/Loading_models

2. what u expect to be right?
#7
Support / Re: transparent objects depth?
September 11, 2012, 02:28:37 PM
Quote from: EgonOlsen on August 30, 2012, 07:06:11 AM
That's another, albeit related issue. The sorting has to use some point of the object to determine its depth. So it takes the center of the object transformed into camera space. As you can easily imagine, this sorting can never be perfect in all cases (if it where, nobody would need a depth buffer at all), which leads to these results. For special cases, you can tweak the sorting with Object3D.setSortOffset(), but that's most likely not suitable here.
I also encounter this problem. I need to set the object transparency to make "every pixel with a color of #000000 will be completely transparent ". And the problem occurs. When rotating the whole scene in certain angle,the object which should be in front is rendered to back.  How to make object A in front of object B from whatever camera angle. I think in my scene , object A is in front of object B for ever when it is visible. can the method setSortOffset works. I set the offset of object A always bigger or smaller than object B,it doesn't work.
#8
Quote from: EgonOlsen on September 10, 2012, 05:24:21 PM
I can't look at it within the next two week (see the news section). But maybe somebody else can have a look. I might be able to help if i only could understand the problem....
ok,i'll try to make it clear.

look the image above.I expect the object go from placeA to placeB,then placeB to placeC,with two rotating.
Now it jump from placeB to placeD when doing the second rotating.
The placeD looks like right upon the placeA seeing form pic1.

the key rotating function code attached:
private void doAnimation(){
    mtAnim1 = (Animation) new Animation();
    mtAnim1.addAnimationListener(new IAnimationListener() {
@Override
public void processAnimationEvent(AnimationEvent ae) {

    // TODO Auto-generated method stub
    switch (ae.getId()) {
    case AnimationEvent.ANIMATION_STARTED:
    vector1 = new SimpleVector(cube.getTransformedCenter());
    vector1.add(new SimpleVector(-10,0,0));
    cube.setRotationPivot(vector1);
    case AnimationEvent.ANIMATION_UPDATED:
    cube.rotateZ(ae.getStepDelta());
break;
    case AnimationEvent.ANIMATION_ENDED:
mtAnim2.setFromValue(0);
mtAnim2.setmToValue((float)Math.PI);
mtAnim2.setAnimationDuration(5000);
mtAnim2.start();
break;
    }
}
    });
    mtAnim1.setMTApplication(this);
   
    mtAnim1.setFromValue(0);
    mtAnim1.setmToValue((float)Math.PI);
    mtAnim1.setAnimationDuration(5000);
    mtAnim1.start();
   
    mtAnim2 = (Animation) new Animation();
    mtAnim2.addAnimationListener(new IAnimationListener() {
@Override
public void processAnimationEvent(AnimationEvent ae) {
    // TODO Auto-generated method stub
    switch (ae.getId()) {
    case AnimationEvent.ANIMATION_STARTED:
    vector2 = new SimpleVector(cube.getTransformedCenter());
    vector2.add(new SimpleVector(0,0,-10));
    cube.setRotationPivot(vector2);
    case AnimationEvent.ANIMATION_UPDATED:
    cube.rotateX(ae.getStepDelta());
break;
    case AnimationEvent.ANIMATION_ENDED:
break;
    }
}
    });
    mtAnim2.setMTApplication(this);
}
#9
News / Re: Happy Birthday!
September 11, 2012, 03:44:33 AM
Happy Birthday! ;)
#10
News / Re: A book on mobile game engines...
September 11, 2012, 03:43:01 AM
Quote from: kiffa on August 13, 2012, 08:42:19 AM
I will read it. But seems i can't access this address.(http://mobilegameengines.com/interviews_with_mobile_game_engine_developers)

I don't know whether the server can't be access now or it is blocked by China_Greate_Fire_Wall.
u can use freegate to visit it .
#11
Quote from: Thomas. on September 10, 2012, 07:45:09 PM
I'm not sure, what exactly you want to do, but keep in mind Object3D.getTransformedCenter() is in worldspace and Object3D.setRotationPivot(SimpleVector) in objectspace...

thanks thomas.
I want the rotating play smoothly,but as u see in the demo,it jump away and then do the second rotating.
I choose two pivot randomly by Object3D.getTransformedCenter().In my project the two pivots are two simpleVector of point object described in obj file.
Do u mean I have to transform the vector of pivots to the rotating object's objectspace.How to do this?
#12
Quote from: EgonOlsen on September 07, 2012, 07:49:18 PM
I don't get it...maybe a drawing can help... ???
I don't know how to fix it. I make a simple demo to display the problem.
would u please review it and help me .
Place the src folder in the HelloWorld project.
Just click on the cube .and see the doAnimation() method.
thanks very much.

[attachment deleted by admin]
#13
Quote from: EgonOlsen on September 07, 2012, 02:02:48 PM
Rotations are cumulative but the pivot are not, because they will be evaluated at render time only. This means that the last pivot is the one that will be taken for rendering. In your case, you might want to consider to use dummy Object3Ds instead, assign them as parents to your actual object do the rotations on them instead.

Maybe u misunderstand what i mean. The whole animation can be divided to two stage. In stage one, the object rotatez with the vector pivotz by setprivot method, and it play very well.After stage one completed,the object translate to new place .After all these done, I setprivot to the new one which is privotx,and I want the object to rotate with axis-x. And also the object rotate with the new pivot ,but just not from the new place to which the stage one translate. At the time stage one ended and stage two started,the object moves away and rotatex from that place. It looks like in stage one the object rotatez with its center vector but not the pivotz which been set.

The rotating plays well , but not continuously. And I don't know why the place changed in the beginning of the stage two.
thanks.

#14
Dear Egon,

I want to perform an effect that a object rotatez with the vector "Pivotz" for degree A.
And then in the new place rotatex with vector "pivotx" for degree B.
The first rotating works well,and the second rotating works too,but not start from the new place.
It seems to start from the original place,just like the first rotating is with its own center vector.

thx very much.
#15
Quote from: EgonOlsen on September 06, 2012, 09:56:33 AM
The name in the mtl-file is the name of the material that is referenced by the obj file. There can be multiple references from one obj to different materials, so there's no way to say that an obj is named after a material. What do you want that for?

thanks. Every object in my obj file references one material defined in mtl file with "usemtl xxx". And the name of the object(such as object1,object2,which is hard to recognize) is different from the one in mtl file(such as slide,which is easy to recognized).
I just wanted to obtain the object with the name of the material. Now i find it's stupid.   I change the name of object one by one manually ,keeping it the same as the one in mtl file.
And problem solved.
Thank you for your help.