Archived

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

RonHiler

Backward x axis

Recommended Posts

RonHiler    214
Hey guys, In working on my D3D world, I ran through a few checks and discovered an odd thing. I expected the (0, height, 0) value to be the northwestern corner of my landblock. It turns out that this is the northeastern corner! The northwestern corner is actually at (landblockwidth, height, 0), which is entirely backward from where it ought to be! With further checks, I found that placing an item on the ground at 0,0 (x,z, I'll ignore the height value from here on out) also puts the item in the northeastern corner. Also, I did a test texture with N-S-E-W letters at appropriate places and put it on the landscape. It appeared backward. N was at the top, but the letter itself was upside down (the crossbar was backward, as if a child had written a backward N). E was at the western end, W was at the eastern end, and S was at the bottom. In all cases the letters were flipped over. I checked my UV coords, and they clearly go from 0->1, with texture coord 0,0 seeming to be at the northeastern corner (although it ought to be at the northwestern corner). This is very confusing to me. It's almost like the entire landscape is upside down and the player is moving along the *bottom* of the terrain. However, I have no idea of where to even *begin* looking for a bug like this Any suggestions? Ron [edited by - RonHiler on January 17, 2004 11:38:29 PM]

Share this post


Link to post
Share on other sites
Raloth    379
Set a scale matrix to (-1,1,1), this will flip the world around for you. Alternatively, you could change your up vector from (0,1,0) to (0,-1,0), assuming that''s what you have.

Share this post


Link to post
Share on other sites
RonHiler    214
Yeah, I suppose that would work except for two things.

One, it''s a hack. Sure I could put my up vector as 0,-1,0 to fix the bug, but clearly my up vector is 0,1,0. I''m not fixing the underlying problem, I''m just throwing in a deliberate bug to fix another one. I want to understand why it''s doing what it''s doing, not psuedo-fix it

Two, as far as I can tell, the terrain geometry is right side up. I''m double checking my terrain generator against the greyscales I used to create the geometry now (and it''s not as obvious as you might think it would be at first), but I''m pretty positive the terrain is correct as far as the heights go.

After working with it a bit more, I''m beginning to think things are not so much upside down as they are mirrored across the z-axis plane. Somehow I''ve got a mirror of my world rather than my world itself. It is very odd

Share this post


Link to post
Share on other sites
RonHiler    214
There''s nothing unusual about it, I don''t think....

LandBlock.CameraEyePoint = D3DXVECTOR3(0.0f, 2.0f, 0.0f);
LandBlock.CameraLookAt = D3DXVECTOR3(0.0f, 2.0f, 5.0f);
LandBlock.CameraUp = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
.....
D3DXMatrixLookAtLH(&matView, &LandBlock.CameraEyePoint, &LandBlock.CameraLookAt, &LandBlock.CameraUp);
.....
D3DDevice->SetTransform(D3DTS_VIEW, &matView);

Share this post


Link to post
Share on other sites