#### Archived

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

# wtf!?!? stupid thing

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

## Recommended Posts

ok, im making a small 3d engine thing, right now you just kinda fly around. i got the rotations to work out right, but lets say you rotate to the left 90 degrees, then hit the up button, you excpect to go forward right? well, you go to the right, is there a way i can fix this? thanks if you need more detail or need to see my code just tell me

##### Share on other sites
Hehe, oops.... I misread your post, I apologize for doing that

Edited by - Lord Karnus on November 4, 2001 6:48:35 AM

##### Share on other sites
This has nothing to do with rotations nor with the gimbal lock, that''s something totally different.

All you need to do is update your camera translation depending on your flight direction.

- AH

##### Share on other sites
When rotating, say

##### Share on other sites
When rotating, say

##### Share on other sites
Wow, these forums are short on help aren''t they?

I think, Samith, that you need to (as mr. Anonymous Poster stated) change the translation you do when going ''forward''.

Picture this: If you''re facing North and you walk forward, you''ll move North. But if you''re facing West and you walk forward, which way do you think you''ll move?

Your program says North.

How to make it say West?

Your rotation should be calculated from the positive x direction, with the left-rotation as positive to work.

So use this: (steplength is how far you''ll move)
translation for x = cos(rotation) * steplength
translation for z = sin(rotation) * steplength

Make sure you convert to radians first (rotation * 3.141592653589793238462643383279502884197169399375105820974944 / 180) so the sines and cosines work right.

##### Share on other sites
quote:

Make sure you convert to radians first (rotation * 3.141592653589793238462643383279502884197169399375105820974944 / 180) so the sines and cosines work right.

LOL This is sick, you have a PI-mania...

- AH

##### Share on other sites
What''s crazy is that''s all from memory

##### Share on other sites
What''s crazy is that''s all from memory

##### Share on other sites
How long did it take you to memorize pi to 58 digits? I think I counted right

not exactly!
it is 61

##### Share on other sites
I think it was 5 digits a night for 8 nights, 8 years ago.

##### Share on other sites
Shit, you learned that stuff 8 years ago and still know it ?!

Things like that are deleted by my brains garbage collector after 2 weeks... What a waste of (neural-) memory...

- AH

##### Share on other sites
I bet knowing pi to 61 decimal places would come in handy a lot . Maybe a party trick for a *really* boring party?

And with double prescision floating point storage, you get the whole thing taken back to 3.14159265358979 : 14 digits.

Why not memorise some other useful things, like Sqr(2), or the first page of your phone directory... you''d be famous

Trying is the first step towards failure.

##### Share on other sites
Actually I memorized it to 100 places. The 60 are all that''s left. But that''s beside the point.

##### Share on other sites
you see that is what ur computers clip board is for ... ctrl-c ... ctrl-v lol ... works great sept when u copy a few digits too many and vc++ freaks out but what can you expect ;-)

##### Share on other sites
Can I just demonstrate something here please?

When I decided to memorise pi I got to around

here
|
v
3.141592653589793238462643383279502884197169399375105820974944

And some people I knew were quite impressed I''d done that! Because you see, just because pi is a really complex number doesn''t mean you have to memorise it, did your calculator at school not have a pi button? *g*

*lol*

Sorry mate - that is actually quite impressive! I know for a fact that I couldn''t memorise it to 20 places, let alone 100!!! Though the question has to be asked - why???

##### Share on other sites
Samith there is another way to do it.

CVector mView; //Crank the view and position in those
CVector mPosition;

void MoveCamera(float speed)
{
CVector vector={0};

vector.x = mView.x - mPosition.x;
vector.y = mView.y - mPosition.y;
vector.z = mView.z - mPosition.z;

mPosition.x += vector.x * speed;
mPosition.z += vector.z * speed;
mView.x += vector.x * speed;
mView.z += vector.z * speed;
mView.y += vector.z * speed;
mPosition.y += vector.z * speed;
gluLookAt(mPositon.x,mPosition.y,mPosition.z,mView.x,mView.y,mView.z,0,0,0);
}

//it suppose to work. Just MoveCamera(-X)to move back and //MoveCamera(X) to move forward.

##### Share on other sites
loop through this a few times
{
yy = a;
a = (a + b) / 2;
b = sqrt(b*yy);
c = c - xx * pow((a - yy),2.0);
xx = 2.0 * xx;
pi = pow((a + b),2) / (4.0*c) );
}

##### Share on other sites
thanks a lot ppl!! im gonna go try this stuff right now

##### Share on other sites
You didn''t round the last digit correctly (since the next digit is a 5).

And double precision actually stores 15 digits, I believe.

"Don''t be afraid to dream, for out of such fragile things come miracles."