March 28, 2024, 01:33:26 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Vectors and Matrices

Started by kryton9, August 20, 2006, 04:21:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kryton9

September 02, 2006, 12:31:42 PM #25 Last Edit: September 02, 2006, 12:53:12 PM by kryton9
Got it working. I had to redo my arrow.ÂÃ,  As I wrote my last reply, it dawned on me that I had the arrow pointing up instead of down the z axis in the positive direction :)

Here is the updated arrow model. It is named k9 3d vector.XÂÃ,  , once unzipped that is.

With this overiding the version of the model in reply # 15, it all works.

Just press F1-F8 to see it go right through the points :)

Note:ÂÃ,  If you select point 6 let say to move to. Do not select F6 to look at, that is it will try to look at itself and from what Paul wrote causes problems, as it should. So what ever point you select 1-8 to move to, just don't select the corresponding F# to look at. It works fine all the time now, woo hoo!!

What all this means: We have to make our models in our modeling software face the positive z direction. This means when loaded into Aurora, by default it should be facing away from us and into the screen. Hope that helps.

Download the zip file in reply #15, then once that is unzipped. Download and unzip k9 arrow.zip to overwrite the older model. Enjoy!!

Ionic Wind Support Team

Now you got it ;)

Zumwalt... also when using a LookAt point remember that the point has to be in world space, not local space.  So make sure the bWorld parameter of a meshes GetPosition is TRUE.  In other words the mesh your trying to look at. 
Ionic Wind Support Team

J B Wood (Zumwalt)

mechPOS = m1.getPosition(true);

Didn't change anything, still hammering on it, going to go get food, I am missing something.
Not even with Krytons new mesh does it make a difference, for me at the moment.

Ionic Wind Support Team

OK the problem your having is that the LookAt command doesn't take into account any translations done by parent objects.  I'll have to think on that one for a moment.  It was designed to work from top level object to top level object.
Ionic Wind Support Team

J B Wood (Zumwalt)

Thanks Paul.
Just about everything in the 3d world will require an equal on the translation level and not just the top level.
Makes things tougher to figure out initially but good in the long run.

Ionic Wind Support Team

Again it was adapted from the Camera LookAt method, and a camera is always top level, so give me a bit of slack ;)

I'll have some solution for it before the next update.  I have to work backwords though the matrices to convert a world space lookat point to a local one for the 'looker', while respecting a possible infinate number of parent world transforms. So it's not a quicky fix.

Ionic Wind Support Team

J B Wood (Zumwalt)

No rush, I am going through a book I bought on Beginning Math and Physics for Game Programmers.
Its lacking though.

Ionic Wind Support Team

Actually the solution was easy, just not enough coffee at the time.  Just a simple matter of converting world space to local space using the inverse of the parent(s) transformation matrix. 

I'll have an update tomorrow probably.
Ionic Wind Support Team

Ionic Wind Support Team

And you also need an adjustment to your code as well after the update.

      tX=midTarget.x;
      tY=midTarget.y;
      tZ=midTarget.z;
      trans.lookat(tX,0.0f,tZ);

Would be wrong since it is not a Y value of 0.0(world) you want to look at, but the current Y value of the transformation object in world cooridnates.  Which allows the machine gun to rotate without changing it's current Y position.  So I changed it to:

      kryton9POS = km.GetPosition(0);
      VECTOR3 transPosWorld = trans.getposition(1);

......
      tX=midTarget.x;
      tY=midTarget.y;
      tZ=midTarget.z;
      trans.lookat(tX,TransPosWorld.y,tZ);

And I can now drive the tank everywhere and the machine gun rotates to follow the correct location.

Paul.
Ionic Wind Support Team

J B Wood (Zumwalt)

Thanks a ton Paul, you are definately the man!
Can't wait for this patch.

kryton9

That will be cool to see. Great!

Ionic Wind Support Team

Just in case you missed it zumwalt, the update was posted today ;)
Ionic Wind Support Team

J B Wood (Zumwalt)

Thanks I just got it like a few minutes ago and updated the code, the latest download build has it encorporated.
I took my final on my CCSI exam today, won't get results for another 10 days, but that was an all day event.
Thanks a ton for doing this.

Ionic Wind Support Team

How do feel you did on the exam? 
Ionic Wind Support Team

J B Wood (Zumwalt)

Not so good, hopefully either a C or a B, no way I got an A, but it cost me 7 hours of my life :(
I got stuck on the 3 major investigative tools an agent uses when investigating malicious software.
The book didn't describe them, nor was it in the lectures.
I'll talk to the professor about it tomorrow hopefully.
I have 4 more of those CCSI type classes left before I qualify for any FBI classes.

Ionic Wind Support Team

I've had a few exams like that.  Tend to suck the life out of you for a couple of days ;)
Ionic Wind Support Team

J B Wood (Zumwalt)

It will definately ruin my holiday if I think about it to much, going to not worry about it now, I had a 94% in the class going into the final, with an ungraded 12 page report, the report is worth 20% of my grade, the final worth 25% of my grade, between the two, they can take my A to a F.