Math question about my vectors

Discussion about everything. New games, 3d math, development tips...
Post Reply
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Math question about my vectors

Post by 3DModelerMan »

Hi I have vectors that store, my nodes rotation,and position, I don't know which I should keep the same and wich ones I should increment/ decrement for my node to move forward, here's my code

Code: Select all

main_player_wolf->setPosition( vector3df( wolf_rotX, wolf_rotY, wolf_rotZ + 1 ) + vector3df( wolf_posX + 1, wolf_posY + 1, wolf_posZ + 1 ) );
. Could someone please show me an example of what I should do?. Thanks :D .
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

you should really learn vectormath dude.

http://chortle.ccsu.edu/VectorLessons/vectorIndex.html
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

I will

Post by 3DModelerMan »

Okay I'll look into that, but it does'nt seem to have anything on what I'm doing, all I want now is to see what I'm doing wrong.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

everything really^^
u will have to set some zero rotation forward vector like
0,0,1 : thats forward when rotation is 0,0,0

now make a matrix and set its roation to ur current rotation.

now u transform your forward vector(here 0,0,1) by this matrix.

that resulting vector is forward. now just normlize it and multiply by ur speed then add to ur current position.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

thanks

Post by 3DModelerMan »

Oh thanks! :D .
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

You don't need to normalize in the previous example though. If you have your direction vector which is normalized and make a matrix out of a rotation vector, it should come out normalized.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

okay

Post by 3DModelerMan »

Yeah, thanks :D.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Post Reply