Require help, Matrix and Billboards
by CdnGater · in Torque Game Engine · 07/23/2004 (4:22 am) · 2 replies
Hi,
Matrixes are not my strong point and I need some help from someone who knows a lot more than me.
I have need of an Z,Y,X axis aligned billboards. I searched the code base and found spherical billboards. So I used that to get billboards. So anyway, I did some more searching and found the function forceFaceCameraZAxis, with a couple of modifications to remove the shape stuff and to rename it, I got ZAxis aligned billboards.
As I started with, matrixes are not my strong point. So I do not know what I need to modifiy to create YAxis and XAxis billbords.
Here is the function
Can someone help me create my BillboardYAxis and BillboardXAxis functions please?
Thanks
Edit: Oh another thing, how do I get billboards to rotate using my position, not the way I am facing?
If I am standing still and I rotate, the billboards will rotate as well. I don't want them to rotate until I move to a new position, and then they will rotate to face my position again. Am I making sence?
Matrixes are not my strong point and I need some help from someone who knows a lot more than me.
I have need of an Z,Y,X axis aligned billboards. I searched the code base and found spherical billboards. So I used that to get billboards. So anyway, I did some more searching and found the function forceFaceCameraZAxis, with a couple of modifications to remove the shape stuff and to rename it, I got ZAxis aligned billboards.
As I started with, matrixes are not my strong point. So I do not know what I need to modifiy to create YAxis and XAxis billbords.
Here is the function
void BillboardZAxis()
{
MatrixF mat;
dglGetModelview(&mat);
Point3F z;
mat.getColumn(2,&z);
Point3F x,y;
if (mFabs(z.y) < 0.99f)
{
// mCross(Point3F(0,1,0),tAxis,&x);
x.set(z.z,0,-z.x);
x.normalize();
mCross(z,x,&y);
}
else
{
// mCross(z,Point3F(1,0,0),&y);
y.set(0,z.z,-z.y);
y.normalize();
mCross(y,z,&x);
}
mat.setColumn(0,x);
mat.setColumn(1,y);
mat.setColumn(2,z);
dglLoadMatrix(&mat);
}Can someone help me create my BillboardYAxis and BillboardXAxis functions please?
Thanks
Edit: Oh another thing, how do I get billboards to rotate using my position, not the way I am facing?
If I am standing still and I rotate, the billboards will rotate as well. I don't want them to rotate until I move to a new position, and then they will rotate to face my position again. Am I making sence?
Torque Owner CdnGater
Duggan Software Studio
So this is now closed.
btw; here is that tutorial nehe.gamedev.net/data/articles/article.asp?article=19