Bones - Skeletal and Pose Animations for jPCT/jPCT-AE > Bones

Scale Problem?

<< < (2/3) > >>

AGP:
Before animateSkin() ever gets called, I get the following bounding box: -0.328329, 0.343511, -0.159473, 0.230658, 0.00242225, 2.12075.

Afterwards, it becomes: -9.9999998E10, 9.9999998E10, -9.9999998E10, 9.9999998E10, -9.9999998E10, 9.9999998E10

The following is the method with which I print the world-space bounding box:

--- Code: ---    public float[] getWorldSpaceBounds(Object3D obj) {
float[] objectSpaceBounds = obj.getMesh().getBoundingBox();

SimpleVector mins = new SimpleVector(objectSpaceBounds[0], objectSpaceBounds[2], objectSpaceBounds[4]);
SimpleVector maxs = new SimpleVector(objectSpaceBounds[1], objectSpaceBounds[3], objectSpaceBounds[5]);

SimpleVector[] p = new SimpleVector[8];
p[0] = new SimpleVector(mins.x, mins.y, maxs.z);
p[1] = new SimpleVector(mins.x, mins.y, mins.z);
p[2] = new SimpleVector(maxs.x, mins.y, mins.z);
p[3] = new SimpleVector(maxs.x, mins.y, maxs.z);
p[4] = new SimpleVector(maxs.x, maxs.y, mins.z);
p[5] = new SimpleVector(maxs.x, maxs.y, maxs.z);
p[6] = new SimpleVector(mins.x, maxs.y, mins.z);
p[7] = new SimpleVector(mins.x, maxs.y, maxs.z);

float minX = Float.MAX_VALUE;
float minY = Float.MAX_VALUE;
float minZ = Float.MAX_VALUE;
float maxX = -Float.MAX_VALUE;
float maxY = -Float.MAX_VALUE;
float maxZ = -Float.MAX_VALUE;

for (int i = 0; i < 8; i++)  {
p[i].matMul(obj.getWorldTransformation());

if (p[i].x < minX) { minX = p[i].x; }
if (p[i].y < minY) { minY = p[i].y; }
if (p[i].z < minZ) { minZ = p[i].z; }
if (p[i].x > maxX) { maxX = p[i].x; }
if (p[i].y > maxY) { maxY = p[i].y; }
if (p[i].z > maxZ) { maxZ = p[i].z; }
}

float[] worldSpaceBounds = new float[6];
worldSpaceBounds[0] = minX;
worldSpaceBounds[1] = maxX;
worldSpaceBounds[2] = minY;
worldSpaceBounds[3] = maxY;
worldSpaceBounds[4] = minZ;
worldSpaceBounds[5] = maxZ;

return worldSpaceBounds;
}

--- End code ---

EgonOlsen:
How does the bounding box look in object space?

AGP:
Before animateSkin:

--- Quote ---*****Object-space bounds: *****
-0.328329
0.343511
-0.159473
0.230658
0.00242225
2.12075
***** ****** *****
*****World-space bounds: *****
-0.328329
0.343511
-0.159473
0.230658
0.00242225
2.12075
***** ****** *****

--- End quote ---

After animateSkin:

--- Quote ---*****Object-space bounds: *****
9.9999998E10
-9.9999998E10
9.9999998E10
-9.9999998E10
9.9999998E10
-9.9999998E10
***** ****** *****
*****World-space bounds: *****
-9.9999998E10
9.9999998E10
-9.9999998E10
9.9999998E10
-9.9999998E10
9.9999998E10
***** ****** *****

--- End quote ---

Any clues?

EgonOlsen:
These values look like the initial values of the BB calculation. Which basically means that the object that you are using to calculate the BB on...is empty (i.e. no vertices at all).

AGP:
I assume you mean that only the post-animateSkin values don't have vertices. Raft, any clue as to how animateSkin could destroy the model's vertices?