Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

The Pentium Guy

Clarification on Transformations in d3d

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey, im a little confused on transformations in d3d im making a racing game, my meshes (both the car and the platform) have an instance of my camera class when i render i do this (in "pseudocode") beginscene world = identity platform.setupwrld platform.render car.setupworld car.render in my meshes render procedures it looks something like this: View = lookatLH(camera.location,camera.target,new vector3(0,1,0) Projection = PerspectiveFOVLH(pi/4,1,0,300) here''s where the problem coems in: the movement when i move (for example) up, i say platform.cam.move(-3) //move the platform down so that the car will .. "move up" however, i want to do mesh intersection, so i''ll need to store the car''s "real" coordinates (or what ''seems'' to be the car''s "Real" coordinates)... [looking for words here lol] i''m just unclear on how the transformations work, and if im doing this right in the first place... what i really want is more of a "view camera", a v3 which stores the car''s "real" coordinates, and the same for the ground..(i think) sorry for being unclear as im .. lol .. confusing myself as im writing this message.. i just need clarifications on tranformations.. thanks pent

Share this post


Link to post
Share on other sites
Advertisement
Read up on Matrices & Vectors.
If ypu want to get the "real" position of your mesh you do next

m - 4x4 matrix
v - vector to translate (X,Y,Z,W)
e - translated vector (X,Y,Z,W)

e.x = m.x1 * v.x + m.y1 * v.y + m.z1 * v.z + m.w1 * v.w
e.y = m.x2 * v.x + m.y2 * v.y + m.z2 * v.z + m.w2 * v.w
e.z = m.x3 * v.x + m.y3 * v.y + m.z3 * v.z + m.w3 * v.w
e.w = m.x4 * v.x + m.y4 * v.y + m.z4 * v.z + m.w4 * v.w

i think this is it, buth I am not shure
As I said check the tutorials.

Share this post


Link to post
Share on other sites
quote:
Original post by The Pentium Guy
lol, i dont mean to sound rude
but could you please explain how i would have to render my example? like in what order i have to render..etc


Of course you are not rude

quote:

sorry for being unclear as im .. lol .. confusing myself as im writing this message..



It's yust I don't understand your example the best

I will try buth don't be suprised if I dont give you wath you wanted

So
quote:

e.x = m.x1 * v.x + m.y1 * v.y + m.z1 * v.z + m.w1 * v.w
e.y = m.x2 * v.x + m.y2 * v.y + m.z2 * v.z + m.w2 * v.w
e.z = m.x3 * v.x + m.y3 * v.y + m.z3 * v.z + m.w3 * v.w
e.w = m.x4 * v.x + m.y4 * v.y + m.z4 * v.z + m.w4 * v.w



this is an transformation formula. This is done by the Video Card's GPU to each wertex.

So use this formula on each of your models vertex to find out where are the vertices actualy in the world cordinates.

in that woud be

for (i = 0;i < car.num_of_vertices; i++)
{
car.vertices = formula_above (car.vertices[i], WorldMatrix)
}

Buth this is quite CPU consuming sou you shoud "put a box" around your model then use the uper formula to transform the box edges and check the box coallision.

I don't qnow if you got me buth I shure don't hawe a clue what that loks like


[edited by - Red Drake on June 3, 2004 4:23:18 PM]

[edited by - Red Drake on June 3, 2004 4:24:26 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!