hi, can you give me the formula, i would like to have a wave-like movement of my
spaceship, so it''ll be something like this...
> > > >
> > > > > >
> > >
there... that''s the movement of my ship, i want it like that but instaed of horizontal, i will do it vertically, thanks!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
Ship.y = Ship.y + sin(c)
where c is a counter for -Inf to +Inf
one cycale is equ to Pi * 2 ( 6.28 )
hope that helps
-Ian
where c is a counter for -Inf to +Inf
one cycale is equ to Pi * 2 ( 6.28 )
hope that helps
-Ian
hi! can i ask for more help? it seems i can't figure it out i used to move my ship from top to bottom like this...
ship.y += velX * (tickDiff / 1000.0f)
now, how will i use put in the formula there? thanks!!!
i tried doing this hehe....
ship.y += sin(3.14 * 2 * 6.28 * velX * (tickDiff / 1000.0f)
thanks again!
Edited by - mickey on February 23, 2002 5:52:32 AM
ship.y += velX * (tickDiff / 1000.0f)
now, how will i use put in the formula there? thanks!!!
i tried doing this hehe....
ship.y += sin(3.14 * 2 * 6.28 * velX * (tickDiff / 1000.0f)
thanks again!
Edited by - mickey on February 23, 2002 5:52:32 AM
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
did you notice you are using x velocity for y?
I think this will work
ship.y += (velY * (tickDiff/1000.0f)) * sin(c);
You need to pass a double to sin because sin uses radians. It will return a value from -1 to 1.
I think this will work
ship.y += (velY * (tickDiff/1000.0f)) * sin(c);
You need to pass a double to sin because sin uses radians. It will return a value from -1 to 1.
evilclown, oh that was just a typo error here hehe sorry, i''m sorry clown but i uhh.. plz.. tell me exactly the values i will put in c on sin(c)... thanks!!!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
c can be any value you like
if you have a graphing calc then graphe this x1=sin(x)
x=-Inf to +Inf
where Inf = infinaty
to get one full sin wave out of size start at 0 and goto 2*Pi (e.g. 6.28 )
-Ian
Edit: Missed Value
Edited by - VBLimits on February 23, 2002 5:58:55 PM
if you have a graphing calc then graphe this x1=sin(x)
x=-Inf to +Inf
where Inf = infinaty
to get one full sin wave out of size start at 0 and goto 2*Pi (e.g. 6.28 )
-Ian
Edit: Missed Value
Edited by - VBLimits on February 23, 2002 5:58:55 PM
hey guys i did it! My problem though is that I only changed the ship''s Y value, i should also changed the X value;
i used this, pls see if it''s correct,
double pi = 3.14;
double ValueX = 0.015, ValueY = 0.001;
ValueX += 0.015;
ValueY += 0.001;
alien.X += alien.VelX * (dwTickDiff / 1000.0f) * sin(ValueX * pi);
alien.Y += alien.VelY * (dwTickDiff / 1000.0f) * sin(ValueY * pi);
then everytime i increment the ValueX and ValueY, so the sin changes, is that why you guys trying to explain?
oh, one more thing, how do i do now when i want my ship to go round in circle? and how do i actually control these angles? any link to a good game math?
i used this, pls see if it''s correct,
double pi = 3.14;
double ValueX = 0.015, ValueY = 0.001;
ValueX += 0.015;
ValueY += 0.001;
alien.X += alien.VelX * (dwTickDiff / 1000.0f) * sin(ValueX * pi);
alien.Y += alien.VelY * (dwTickDiff / 1000.0f) * sin(ValueY * pi);
then everytime i increment the ValueX and ValueY, so the sin changes, is that why you guys trying to explain?
oh, one more thing, how do i do now when i want my ship to go round in circle? and how do i actually control these angles? any link to a good game math?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
If I understand what you are trying to do right, try this:
alien.X += alien.VelX * (dwTickDiff / 1000.0f);
alien.Y += alien.VelY * (dwTickDiff / 1000.0f) * sin(ValueY * pi);
Here''s some math links:
http://rookscape.com/vbgaming/tutorials.php (written in vb but might be what you''re looking for)
http://www.gamedev.net/reference/list.asp?categoryid=28
alien.X += alien.VelX * (dwTickDiff / 1000.0f);
alien.Y += alien.VelY * (dwTickDiff / 1000.0f) * sin(ValueY * pi);
Here''s some math links:
http://rookscape.com/vbgaming/tutorials.php (written in vb but might be what you''re looking for)
http://www.gamedev.net/reference/list.asp?categoryid=28
evilclown: whoa, that thing makes my ship goes off the screen, i should also use a sin on the x positin of the ship, if i take of the sin, it will not work properly,
anway, thanks for the link!
ps, how about the formula to make the ship go round and round and round..?
anway, thanks for the link!
ps, how about the formula to make the ship go round and round and round..?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
evilclown, you''re vb link helped a bit, but i still need more information about the use of sines and what kind of values to put there to effectively get the angles that i want, do you have any other link? i read the optimizing your trigo functions there
hmm.. maybe you can explain a bit about sines? why not Cosine anyways? they both divides by the hypotenuse right?
thanks so much guys!!!
hmm.. maybe you can explain a bit about sines? why not Cosine anyways? they both divides by the hypotenuse right?
thanks so much guys!!!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement