### Author Topic: How to make checkForCollisionEllipsoid's Ellipsoid visible?my bug?  (Read 984 times)

#### Uncle Ray

• int
• Posts: 81
##### How to make checkForCollisionEllipsoid's Ellipsoid visible?my bug?
« on: May 22, 2015, 01:16:05 pm »
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);
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?

#### Uncle Ray

• int
• Posts: 81
##### Re: How to make checkForCollisionEllipsoid's Ellipsoid visible?my bug?
« Reply #1 on: May 22, 2015, 01:21:38 pm »
I just need create a Ellipsoid,which is the same width,height,lengh and position with checkforcollitionEllipsoid's Ellipsoid.

Any helps will be much appreciated.

#### EgonOlsen

• Posts: 11899
##### Re: How to make checkForCollisionEllipsoid's Ellipsoid visible?my bug?
« Reply #2 on: May 22, 2015, 04:06:03 pm »

#### Uncle Ray

• int
• Posts: 81
##### Re: How to make checkForCollisionEllipsoid's Ellipsoid visible?my bug?
« Reply #3 on: May 22, 2015, 05:08:01 pm »
problem still.ego,how do you make the collide ellipsoid viaible?
maybe my code was wrong?
i just need to see the collide ellipsoid.
any tips?