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.


Topics - Uncle Ray

Pages: [1] 2
1
Support / why translate and setorigin are different location?
« on: September 21, 2015, 06:19:51 am »
method A
{
obj.cleartranslation();
obj.translate(10,10,10);
}

method B
{
obj.cleartranslation();
obj.setorigin(10,10,10);
}


In my project,method A and method B are different obj's location,
Any tips?

2
SimpleVector Ellipsoid=new SimpleVector(0,0,0)
SimpleVector boundingEllipsoid =new SimpleVector(0,0,0)
Object3D boundingbox;
Object3D target;
float scale=2;
ini()
{
                 target=...............;
                 target.setscale(scale);
                float[] box = target.getMesh().getBoundingBox();
      float widthX = box[1] - box[0];
      float heightY = box[3] - box[2];
      float lengthZ = box[5] - box[4];
      ellipsoid.x = widthX/2+1 ;
      ellipsoid.y = heightY/2+1 ;
      ellipsoid.z = lengthZ/2+1 ;
               boundingEllipsoid.x=ellipsoid.x*2/scale;
               boundingEllipsoid.y=ellipsoid.y*2/scale;
               boundingEllipsoid.z=ellipsoid.z*2/scale;
 boundingbox= ExtendedPrimitives.createEllipsoid(boundingEllipsoid, 20);
    world.addObject(boundingbox);
    boundingbox.addParent(target);   
    boundingbox.clearTranslation();
    boundingbox.setOrigin(target.getTransformedCenter());
   
}

update()
{
    fix_front=obj.checkForCollisionEllipsoid(front, Ellipsoid,5);
    if(front.equals(fix_front)==true)
    {
      obj.setTransparency(-1);
    }
    if(front.equals(fix_front)==false)
    {
       obj.setTransparency(0);
    }


}





MY PROBLEM:
i want Ellipsoid visible,so i create boundingbox to show the checkEllipsoid's Ellipsoid.but i my program,some times the checkcollideEllipsoid work,and some times checkcollideEllipsoid unwork.

so,i think may be my boundingbox is wrong,so how to create the right boudingbox,the same scale and the same position with checkcollideEllipsoid's Ellipsoid?

3
Object3D source;
Object3D target;
SimpleVector ellipsoid=new SimpleVector(10,10,10);
ini()
{
source.setCollisionMode(Object3D.COLLISION_CHECK_SELF|Object3D.COLLISION_CHECK_OTHERS);
target.setCollisionMode(Object3D.COLLISION_CHECK_SELF|Object3D.COLLISION_CHECK_OTHERS);
source.build();
target.build();
}

update()
{   
    simpleVector front=obj.getZAxis();
     simpleVector fix_front=null;
    fix_front=obj.checkForCollisionEllipsoid(front,ellipsoid, 5);
    if(front.equals(fix_front)==true)
    {
       source.setTransparency(-1);//source will see
    }
    else if(front.equals(fix_front)==false)
    {
       source.setTransparency(0);//source will disappear
    }
   source.translat(fix_front);
}







my problem:
when ellipsoid=(10,10,10) or ellipsoid=(100,100,100);
their checkcollition's distance was the same,just same unit away between source and target,then source be disappear.

so how to change checkcollition's distance?whatever i do with ellipsoid,but the distance just the same.


4
Support / FrameBuffer.freememory sometimes useless?
« on: April 27, 2015, 11:04:34 am »
Solved by ego
Answer:GLSurfaceView.setPreserveEGLContextOnPause(true);

_______________________________________________________
without touch phone's home button,freememory method it was good.
it free memory immediately,very nice.
but if i touch phone's home button and return to my app again.
the freememory method was never work,and the memory was never free.


may be my bug was in onSurfaceChanged?

here is my code:

public void onSurfaceChanged(GL10 gl, int width, int height)
{       
  fb=null;
  fb=new frameeBuffer(width,height);
  Config.unloadImmediately=true;                   
  texturemanage.removeAndUnload("a", fb);      
  texturemanage.removeAndUnload("c", fb);
   ................................................
  fb.freememory;
 }



5
Support / why world.removeObject not destroy object3D?
« on: April 24, 2015, 04:26:21 am »
When i use world.removeObject(obj),and later use world.addObject(obj),the obj  is still there.

i thought removeobject() will clear object from memory,in fact i am wrong?

so,if i want to destroy obj,i just use,
obj.clearobject();
obj.clearrotation();
obj.cleartranslation();
obj=null;


is that right?

in a shorting say,if i want destroy a object3D,which method will free memory,and really set the obj clear?

6
Support / why the same texture shows different in jpct and 3ds max?
« on: January 31, 2015, 07:53:19 am »
solved
Answer:the fbx to obj,have some loss with texture,it is wrong in 3ds max,not jpct
____________________________________________________

here is in 3ds max





here is in jpct

7
Support / May be jpct would add AABBIntersectsAABB
« on: January 27, 2015, 06:17:12 am »
I have done it,may be someone need?
In my project it was worked perfect.
public boolean AABBIntersectsAABB(Object3D obj1,Object3D obj2, Update_trackandcar update,World world)
{
   SimpleVector obj1_0=this.new_getworldspacebounds(obj1)[0];
   SimpleVector obj1_1=this.new_getworldspacebounds(obj1)[1];
   SimpleVector obj1_2=this.new_getworldspacebounds(obj1)[2];
   SimpleVector obj1_3=this.new_getworldspacebounds(obj1)[3];
   SimpleVector obj2_0=this.new_getworldspacebounds(obj2)[0];
   SimpleVector obj2_1=this.new_getworldspacebounds(obj2)[1];
   SimpleVector obj2_2=this.new_getworldspacebounds(obj2)[2];
   SimpleVector obj2_3=this.new_getworldspacebounds(obj2)[3];

   
   SimpleVector obj1_front=new SimpleVector(obj1_0.x-obj1_3.x,0,obj1_0.z-obj1_3.z);
   SimpleVector obj1_left=new SimpleVector(obj1_0.x-obj1_1.x,0,obj1_0.z-obj1_1.z);
   SimpleVector obj2_front=new SimpleVector(obj2_0.x-obj2_3.x,0,obj2_0.z-obj2_3.z);
   SimpleVector obj2_left=new SimpleVector(obj2_0.x-obj2_1.x,0,obj2_0.z-obj2_1.z);
   obj1_front.normalize();
   obj1_left.normalize();
   obj2_front.normalize();
   obj2_left.normalize();
   
   
   
   
   
   float distance1_z0=obj1_0.calcDot(obj1_front);
    float distance1_z1=obj1_1.calcDot(obj1_front);
    float distance1_z2=obj1_2.calcDot(obj1_front);
    float distance1_z3=obj1_3.calcDot(obj1_front);
    float distance1_z00=obj1_0.calcDot(obj2_front);
    float distance1_z01=obj1_1.calcDot(obj2_front);
    float distance1_z02=obj1_2.calcDot(obj2_front);
    float distance1_z03=obj1_3.calcDot(obj2_front);
   
    float distance1_x0=obj1_0.calcDot(obj1_left);
    float distance1_x1=obj1_1.calcDot(obj1_left);
    float distance1_x2=obj1_2.calcDot(obj1_left);
    float distance1_x3=obj1_3.calcDot(obj1_left);
    float distance1_x00=obj1_0.calcDot(obj2_left);
    float distance1_x01=obj1_1.calcDot(obj2_left);
    float distance1_x02=obj1_2.calcDot(obj2_left);
    float distance1_x03=obj1_3.calcDot(obj2_left);
   
   
   
    float[] distance1_z=new float[4];
    distance1_z[0]=distance1_z0;
    distance1_z[1]=distance1_z1;
    distance1_z[2]=distance1_z2;
    distance1_z[3]=distance1_z3;
    float[] distance1_z_00=new float[4];
    distance1_z_00[0]=distance1_z00;
    distance1_z_00[1]=distance1_z01;
    distance1_z_00[2]=distance1_z02;
    distance1_z_00[3]=distance1_z03;
   
   
   
    float[] distance1_x=new float[4];
    distance1_x[0]=distance1_x0;
    distance1_x[1]=distance1_x1;
    distance1_x[2]=distance1_x2;
    distance1_x[3]=distance1_x3;
   
    float[] distance1_x_00=new float[4];
    distance1_x_00[0]=distance1_x00;
    distance1_x_00[1]=distance1_x01;
    distance1_x_00[2]=distance1_x02;
    distance1_x_00[3]=distance1_x03;
   
   
   
   
    float distance2_z0=obj2_0.calcDot(obj1_front);
    float distance2_z1=obj2_1.calcDot(obj1_front);
    float distance2_z2=obj2_2.calcDot(obj1_front);
    float distance2_z3=obj2_3.calcDot(obj1_front);
    float distance2_z00=obj2_0.calcDot(obj2_front);
    float distance2_z01=obj2_1.calcDot(obj2_front);
    float distance2_z02=obj2_2.calcDot(obj2_front);
    float distance2_z03=obj2_3.calcDot(obj2_front);
   
   
    float distance2_x0=obj2_0.calcDot(obj1_left);
    float distance2_x1=obj2_1.calcDot(obj1_left);
    float distance2_x2=obj2_2.calcDot(obj1_left);
    float distance2_x3=obj2_3.calcDot(obj1_left);
    float distance2_x00=obj2_0.calcDot(obj2_left);
    float distance2_x01=obj2_1.calcDot(obj2_left);
    float distance2_x02=obj2_2.calcDot(obj2_left);
    float distance2_x03=obj2_3.calcDot(obj2_left);
   
   
    float[] distance2_z=new float[4];
    distance2_z[0]=distance2_z0;
    distance2_z[1]=distance2_z1;
    distance2_z[2]=distance2_z2;
    distance2_z[3]=distance2_z3;
    float[] distance2_z_00=new float[4];
    distance2_z_00[0]=distance2_z00;
    distance2_z_00[1]=distance2_z01;
    distance2_z_00[2]=distance2_z02;
    distance2_z_00[3]=distance2_z03;
   
    float[] distance2_x=new float[4];
    distance2_x[0]=distance2_x0;
    distance2_x[1]=distance2_x1;
    distance2_x[2]=distance2_x2;
    distance2_x[3]=distance2_x3;
    float[] distance2_x_00=new float[4];
    distance2_x_00[0]=distance2_x00;
    distance2_x_00[1]=distance2_x01;
    distance2_x_00[2]=distance2_x02;
    distance2_x_00[3]=distance2_x03;
   
   
   
    this.sort(distance1_x);
    this.sort(distance1_z);
    this.sort(distance2_x);
    this.sort(distance2_z);
    this.sort(distance1_x_00);
    this.sort(distance1_z_00);
    this.sort(distance2_x_00);
    this.sort(distance2_z_00);
   
   
   
   
   
   
   
   
   
   
    if(
       (distance1_x[0]>distance2_x[3])
                   ||
        (distance1_x[3]<distance2_x[0])
                   ||           
        (distance1_z[0]>distance2_z[3])
                   ||
        (distance1_z[3]<distance2_z[0])
                   ||
        (distance1_x_00[0]>distance2_x_00[3])
                   ||
        (distance1_x_00[3]<distance2_x_00[0])
                   ||           
        (distance1_z_00[0]>distance2_z_00[3])
                   ||
        (distance1_z_00[3]<distance2_z_00[0])
    )
   
    {return false;}
   
   
    else return true;
}

8
Support / question?where is checkForCollisionEllipsoid's collidecenter?
« on: January 12, 2015, 05:15:49 pm »
solved
Answer:the fbx to obj,have some loss with texture,it is wrong in 3ds max,not jpct
____________________________________________________


obj.checkForCollisionEllipsoid(sv,eclips,6);

where is the eclips's center?
A:the center of obj?
B;the center of obj.mesh.getboundingbox?



and more question how to set the eclipse's center?
A:obj.setCenter(new Simplevector(x,y,z));
the (x,y,z),are coordinate in world's space or object's space?

9
Support / setRotationPivot and 3ds max.
« on: December 26, 2014, 09:39:16 am »
if i changed the model's pivot in 3ds max,and saved as md2(for example new.md2)


when i uesd new.md2 in jpct,the Objec3d A,which loaded new.md2.

question:
1:A's pivot is the old pivot,or the new pivot which i modified in 3ds max?

2:if i want to use the new pivot which 3ds max created,how?
 


10
Support / help!Anyone know object's world coordinate in jbrush?
« on: December 18, 2014, 03:51:59 am »
jbrush just translate,and it dont display the object's world coordinate.
just translate coordinate not world  coordinate.

can any one know how,i just want know the world  coordinate.

any helps will be appreciated.

11
Support / Question,how to set two camera in jpct?
« on: October 20, 2014, 02:43:01 pm »
SOLVED
Thanks for ego's and thomas's great help,the problem solved perfect.

Just two cameras in the same screen,how to implement?
Is the any example?
Thx,ego.
Just a little simple example,any help will be much appreciated.


12
Support / if i want to delete the Object3D,which way better fps?
« on: October 13, 2014, 07:21:54 am »
SOLVED THX EGO





in my project,i want to create a missile,when it hit the target,it must be disappear.
i set the missile to Object3D.
Here is some ways:
1.
missile.clearobject;

2.
world.removeobject(missile);

3.missile.setvisbility(fasle);

which way is better fps?


And more,if i want object invisibility,which way is better fps?
1.setvisibility(false);
2.setTransparency(0);
3.settexture("trans"),
the"trans" is a transparent png,so the object would be invisibility.



Thx ego

13
Support / how to transition transparent?
« on: October 08, 2014, 07:11:42 am »
SOLVED THX EGO



this is what i want!











this is what my project.
the problem is the texture have many tanspanrent value, but in jpct only have one single transparent value,how can i to achieve a transition
effect.
here is the texture
:





14
Support / why set texture with 128*128 png is ok,but 128*256 it is none?
« on: October 08, 2014, 05:08:17 am »
SOLVED THX EGO
with the Objetc3D ,i used the same png for set texture,when it's resolution 128*128,everything is ok.
but when it's resolution is 128*256,the object3D was displayed nothing but black.

whether the texture must be 128*128,256*256.....?

15
i have two files,a.ser,a1.3ds.
there are the same thing just different format,this is the big model which contains many parts.i want every part of it is the single objetc3D
in jpct.here is the code:

which is ok:

Object3D[] waypoint= Loader.load3DS(res.openRawResource(r.raw.a1), 1);   
           
 world.addObject(waypoint[1]);




which is wrong:
Object3D[] waypoint= Loader.loadSerializedObjectArray(res.openRawResource(r.raw.a));   
world.addObject(waypoint[1]);





ps:the model have 100 parts,use load3ds everything is ok.
use loadSerializedObjectArray,just world.addObject(waypoint[0]) is ok,and show 100 parts.
i think,in loadSerializedObjectArray all of parts is saved in waypoint[0] not waypoint[].
How can i fix it?
thx,ego.

Pages: [1] 2