Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


theo2005

Member Since 16 Apr 2012
Offline Last Active Aug 09 2012 02:54 PM

Posts I've Made

In Topic: Collision coordinate junk!?!? (full main source code)

09 August 2012 - 08:47 AM

Are the values returned from XAnimator->GetBoundingShapes() what you expect? No point in trying to mess with all the matrix math if your inputs aren't what you think they should be.


I don't frankly know what to expect. All I know is that I'm doing exactly what the author of the API is doing except I don't use his debug library (which I don't have) to draw the bounds. I did a number of tests. Supposedly if max bounds of object A is bigger than min bounds of object B, they collide. So I did those kinds of checks and set it to stop movement if it happens to be true. The thing is, my movement stops with any checks I make, except for when I inverse the check (to smaller instead of bigger). I then go to the object in question and bash myself into every wall and the checks don't trigger.

In the full main source code, there are two functions in the complete bottom. I used to use those. The second one I wrote to store the vertex data and draw the bounds myself. Well, the bounds were shifted in one direction, the size of the object (either length or width) was smaller/shorter. Regardless of that, I still did a bunch of checks and after some bull*** I managed to find some checks that made the skele stop when bashing into one wall. Actually, he stopped a meter before the wall from the inside of the object without any parts touching the walls. The only bounds that the function drew correctly were the skeletons.

What I said above, including the fact that those numbers are indeed very strange in my opinion, I deduced that something must be wrong with matrix math or perhaps some fundamental calculations I have there.

In Topic: Collision coordinate junk!?!? (full main source code)

08 August 2012 - 02:33 AM

I'm not sure how to output a matrix but since it doesn't seem to let me as a multidimensional array.. I guess something like this.

if (count == 0)
   {
    FileWrite(IdentityMatrix[0], IdentityMatrix[1], IdentityMatrix[2],IdentityMatrix[3], 0, 0);
   }

Result: 1 0 0 0

It is the same for every object (0 - 3)

In Topic: Collision coordinate junk!?!? (full main source code)

07 August 2012 - 05:45 PM

Yea that would make IdentityMatrix represent the same combinations as above...

I'll keep looking when I get a chance, hopefully something will turn up.


Thank you

In Topic: Collision coordinate junk!?!? (full main source code)

07 August 2012 - 02:16 PM

From what I can gather, IdentityMatrix seems to be the combination of all linear transforms of all models' rotation and translation up to that point. Is that actually what you wanted? Especially considering the call here:


I changed the code above to:
for (int count = 0; count < ObjectQuantity; ++count)
   {
   D3DXMatrixIdentity(&IdentityMatrix);
   D3DXMatrixMultiply(&IdentityMatrix, &matRotateY[count], &matTranslate[count]);

And the only thing that happened was..

max bound values for two objects (x,y,z) changed from

1.77825e-042  0  0
5  14.3369  1.17549e-038

to...

2.83763e-042  0  0
5  14.3369  1.17549e-038

I hope I addressed the problem you pointed out the correct way. Even though it didn't seemingly contribute to much of an anything except different junk values.

In Topic: Collision coordinate junk!?!? (full main source code)

07 August 2012 - 03:45 AM

What makes you say these numbers are "junk"?


If my objects are positioned at:
void SetObjectCoords ()
{
  TranslateX[SKELE] = 4.0f;
	 TranslateY[SKELE] = 0.2f;
	 TranslateZ[SKELE] = 3.0f;
  TranslateX[FLOOR] = 0.0f;
  TranslateY[FLOOR] = 0.0f;
  TranslateZ[FLOOR] = 0.0f;
  TranslateX[WALL] = 0.0f;
  TranslateY[WALL] = 0.0f;
  TranslateZ[WALL] = 0.0f;
  TranslateX[3] = 5.0f;
  TranslateY[3] = 0.0f;
  TranslateZ[3] = 0.0f;
}

It makes no sense for their max bounds (as the numbers above) to have such values. At least makes no sense for me.

@greenvertex:

These are the parts I think may be faulty:
for (int count = 0; count < ObjectQuantity; ++count)
   {
   D3DXMatrixMultiply(&IdentityMatrix, &matRotateY[count], &matTranslate[count]);
		   // d3ddev->SetTransform(D3DTS_WORLD, &IdentityMatrix);    // set the world transform
   TMeshBounds *indMeshBoundsModelSpace=XAnimator->GetBoundingShapes(ModelID[count],&minBoundsModelSpace,&maxBoundsModelSpace,&sphereCentreModelSpace,&sphereRadius,&numMesh);
There I figured, to get the world matrix, I'd multiply those two matrices like I do when I draw each object:
for (int CountRender = 0;CountRender < ObjectQuantity; ++ CountRender) //draw all the objects despite of which object time calculation is executing
{
 
   D3DXMatrixTranslation(&matTranslate[CountRender], TranslateX[CountRender], TranslateY[CountRender], TranslateZ[CountRender]);
	  XAnimator->Render(ModelID[CountRender], matRotateY[CountRender] * matTranslate[CountRender]  ,(float)timeElapsedSinceLastUpdate[CountRender]);
}

The so called world matrix I got after multiplying, I then use here (which is the most suspicious place imho):
for( int i = 0; i < 8; i++ )
{
  D3DXVec3TransformCoord( &cornersInWorldSpace[i][count], &cornersInModelSpace[i], &IdentityMatrix);
}

I hope that helps..

PARTNERS