• Advertisement
Sign in to follow this  

Simple question

This topic is 2851 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

In DirectX, if I set an object to the specified position which point of the object will be specified position? Example: A box set to the position (1.0f,0.0f,0.0f) Which point is in the specified position? The center? the top left corner?

Share this post


Link to post
Share on other sites
Advertisement
Greetings, All 3d position of an object contains 3 "axis" x, y, z. usually "Y" is the height, "X axis" is the width, "Z axis" position along the horizon, Directx creates a world with infinite coordinates, as a programmer you must limit, you imagine your city and are standing in the center of this, if you increase value in the "Y axis" you up, if we do it in the "X axis" you anger on the right, if we do it in the "Z axis" You advance.

Share this post


Link to post
Share on other sites
Think of all the vertices of your object as offsets. When you set the position all the offsets are now relative to the new position instead of 0,0,0

Square A

1,0
1,1
0,1
0,0


Square B

0.5,-0.5
0.5,0.5
-0.5,0.5
-0.5,-0.5


Both are squares of exactly the same size. If you set position on them then it will appear that the Square A's 4th vertex is moved to the position, but square B will appear to have had it's center moved to the position.

But yeah... vertex positions are all just offsets of the object's position. The default position is 0,0,0

-me

Share this post


Link to post
Share on other sites
Quote:
Original post by Palidine
Think of all the vertices of your object as offsets. When you set the position all the offsets are now relative to the new position instead of 0,0,0

Square A

1,0
1,1
0,1
0,0


Square B

0.5,-0.5
0.5,0.5
-0.5,0.5
-0.5,-0.5


Both are squares of exactly the same size. If you set position on them then it will appear that the Square A's 4th vertex is moved to the position, but square B will appear to have had it's center moved to the position.

But yeah... vertex positions are all just offsets of the object's position. The default position is 0,0,0

-me


So it all depends how I define the vertices...

Thanks a lot

Share this post


Link to post
Share on other sites
Quote:
Original post by Aqua Costa
So it all depends how I define the vertices...


Yep. Exactly. Different customs are useful for different games. Having 0,0,0 be the center of the object is useful in a 3D space game or some 2D games. 0,0,0 at the feet is often useful in 3D shooters where guys run on the ground is often useful, but some people still prefer center in that scenario. In a 2D tile game sometimes bottom left of the image or top left of the image or center depending on how your engine works. It's all what's most intuitive to you; just make sure it's the same for all the objects in your world or you'll get really frustrated [smile]

-me

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement