# Is it ok to steal these?

This topic is 4735 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Rows from my objects world matrix. I want to use them for collision detection for planes. I think I can use the 3rd row, because I want to say that it is facing down the +z axis. I want to use the first row to measure the distance for planes width. And the height, from the second row. Is this pretty common? It seems like the perfect use for a matrix. I dont have to calculate anything, just pull it out of the final matrix. And measure the distance along the vector normals for the planes? I hope I asked this clearly, let me know if it makes no sence.

##### Share on other sites
whats the problem? (it works?)

##### Share on other sites
Quote:
 Original post by Genjixwhats the problem? (it works?)

I have not tried it yet, I'm at work still. I think it will work, I figured someone might have already done this and could confirm that this is a correct means of accomplishing what I want.

##### Share on other sites
What do you mean about getting the 'plane width and height' from the matrix? I assume your object matrix is just three orthonormal vectors and a translation vector, more or less. That doesn't tell you anything about the size of the object, just the location and orientation.

Or am I misunderstanding?

##### Share on other sites
Hrmm, strange enough. It all seemed to be okay, untill I tested it. Now I'm finding seemingly uninitilized values in my matrix. Things like 4.0348234e+ hrmn. I never pulled anything out of them before, I only sent them to d3d when rendering. Anybody have an idea why this code causes these values to go wild? I was able to observe the change after stepping over D3DXMatrixRotationY. I can't see anything wrong here, but then if I could I would not have a problem right?
void	CObjectBase::Update(float tcount){	if(tcount)	{		Vector3 moved (Direction * (Velocity / (1.0f / tcount)));		Internal += moved;	}	D3DXMATRIX				matT;				// transformation	D3DXMATRIX				matS;				// scalar	D3DXMATRIX				matX;				// rotation holder	D3DXMATRIX				matR;	D3DXMatrixScaling(&matS, 1.0f, 1.0f, 1.0f);	D3DXMatrixTranslation(&matT, Internal.x, Internal.y, Internal.z);	D3DXMatrixIdentity(&matR);	D3DXMatrixIdentity(&matX);	D3DXMatrixRotationX(&matX, RotX*(D3DX_PI/180));	D3DXMatrixMultiply(&matR, &matR, &matX);	D3DXMatrixIdentity(&matX);	D3DXMatrixRotationY(&matX, RotY*(D3DX_PI/180));	D3DXMatrixMultiply(&matR, &matR, &matX);	D3DXMatrixIdentity(&matX);	D3DXMatrixRotationZ(&matX, RotZ*(D3DX_PI/180));	D3DXMatrixMultiply(&matR, &matR, &matX);	D3DXMatrixMultiply(&matFinal, &matR, &matT);	return;}

I threw in the matX identity because I thought it might be getting messed up from reusing that var. Please let me know if something looks wrong.

Thanks guys!

EDIT: seems to have something to do with having a negitave number in any of the Rox* vars.

[Edited by - mozie on December 29, 2004 7:29:06 PM]

##### Share on other sites
Quote:
 Original post by jykWhat do you mean about getting the 'plane width and height' from the matrix? I assume your object matrix is just three orthonormal vectors and a translation vector, more or less. That doesn't tell you anything about the size of the object, just the location and orientation.Or am I misunderstanding?

I have the size stored in the planes object properties. I just want to make a vector (plane_center - sphere_center) and use a dot product of the matrix 'x' vector to find the distance.

Reason why:
I think if I keep using a single vector named direction, I would need to calculate the adjcent two vectors. Basicly I store the objects position vector, and the direction vector. If I use the direction vector for plane normal, then I would need to calculate the other two vectors. C = (A dot B) But I only know A (direction), thankfully the matrix stores the other two adjcent vectors. So if I dont use the matrix, then I need to take A, make B a vector that is on the same plane as A, calc C, than take A cross C to get true B.

Right? :/

[Edited by - mozie on December 29, 2004 8:35:02 PM]

##### Share on other sites
okay, nevermind. I guess I was paranoid. When I was checking the data inside of the vectors, I thought it was a bad number it was really just a small number. I think it was about 0.000000008 because it was displayed as -8.54654984984e-8. So, I thought that the math was broke, because I had my bounds detection giving false positives.

I wonder if running a normalize function on the vector that has the data from that row, might clean that up.

##### Share on other sites

This topic is 4735 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628730
• Total Posts
2984423

• 25
• 11
• 10
• 16
• 14