how would I .....
Go back X amount from the origin and then spin
around it, while constantly looking at the origin ?
LE SCRUB
xpos -= cos[heading]*distance;
zpos += sin[heading]*distance;
beware I use lookups for sin/cos
"Like all good things, it starts with a monkey.."
Edited by - monkeyman on May 3, 2001 4:45:53 PM
zpos += sin[heading]*distance;
beware I use lookups for sin/cos
"Like all good things, it starts with a monkey.."
Edited by - monkeyman on May 3, 2001 4:45:53 PM
"Like all good things, it starts with a monkey.."
That just get you moving around in a circle right ?
while constantly looking at the origin is the bit im a bit confusted by.
Interesting little doosey
while constantly looking at the origin is the bit im a bit confusted by.
Interesting little doosey
LE SCRUB
well, you have to increment the heading to spin around, but that code will set your position away from the origin at the correct angle according to your heading..
beware if you use lookups for sin/cos(not really too necessary these days, it''s an old dos habit of mine you need to check for when it goes over 359 degrees ans reset to 0, otherwise CRASH
"Like all good things, it starts with a monkey.."
beware if you use lookups for sin/cos(not really too necessary these days, it''s an old dos habit of mine you need to check for when it goes over 359 degrees ans reset to 0, otherwise CRASH
"Like all good things, it starts with a monkey.."
"Like all good things, it starts with a monkey.."
quote:
beware if you use lookups for sin/cos(not really too necessary these days, it''s an old dos habit of mine you need to check for when it goes over 359 degrees ans reset to 0, otherwise CRASH
or just ''and'' the value with 359
i.e.
xpos -= cos[heading & 359]*distance;
hey cool!
I''ve seen "&" used this way before, I didn''t know exactly what it did..
"Like all good things, it starts with a monkey.."
I''ve seen "&" used this way before, I didn''t know exactly what it did..
"Like all good things, it starts with a monkey.."
"Like all good things, it starts with a monkey.."
May 03, 2001 06:49 PM
>Go back X amount from the origin and then spin around it, while
>constantly looking at the origin ?
glRotatef(spinamount,0,1,0);
glTranslatef(0,0,-X);
wow pretty complicated.
>constantly looking at the origin ?
glRotatef(spinamount,0,1,0);
glTranslatef(0,0,-X);
wow pretty complicated.
so u want to pull of that effect where the game pauses ase u rotate around an object and the keep goin?
quote: Original post by Jx
or just ''and'' the value with 359
i.e.
xpos -= cos[heading & 359]*distance;
Actually.. I believe the modulus operator is what you''re looking for here.. the AND operator will not achieve the effect you want.
int heading;heading %= 360; // this makes sure that: 0 <= heading < 360
I hope that helps..
- Ian Perez (fett@willcomp.com) - "It is by will alone I set my mind in motion"
- Ian Perez (iperez.fett@verizon.net) - "It is by will alone I set my mind in motion"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement