Advertisement

FPS movement probs

Started by August 10, 2000 10:17 PM
7 comments, last by sixb0nes 24 years, 3 months ago
Greets - I''m working on a camera that will mimic the style of the ''Descent'' series by Interplay. (360o rotation and movement) To this point, I can move along a single Y plane, but can''t seem to figure out the equation for variable Pitch. I am already storing pitch in cam->Pitch for rotation. cam->LocX -= sin((cam->Yaw + dangle) * (M_PI180)) * dsize; cam->LocZ -= cos((cam->Yaw + dangle) * (M_PI180)) * dsize; I know I can''t just add Y in there with a sin() on the pitch, because that will throw my other values off kilter. Can anyone point me in the right direction and/or give me a good url for other geom stuffs. Thanks, sixb0nes www.xpression.org
sixb0neshttp://www.xpression.ca
In addition,

I am storing the pitch already, in cam->Pitch.
sixb0neshttp://www.xpression.ca
Advertisement
Someone just asked me this the other day. Here's the formula.

YPos -= (float)sin(Xrotation*piover180) * speed;

That's for forward. Just change - to + for backwards.

Hope that helps!


~-=-=-=-=-=-=~
~Justin Eslinger~
~.."BlackScar"..~
~-=-=-=-=-=-=~

Edited by - BlackScar on August 11, 2000 1:53:19 AM
~-=-=-=-=-=-=~~Justin Eslinger~~.."BlackScar"..~~-=-=-=-=-=-=~
Hey,

Adding that line of code will not work as the xz values will
be screwy afterwards (see my first post) .. somehow they need to reflect the change in the Y.


Anyone?
sixb0nes
www.xpression.org


Edited by - sixb0nes on August 11, 2000 10:10:49 AM
sixb0neshttp://www.xpression.ca
have a look at defender, world builder at
http://members.xoom.com/myBollux. the first is with source code
uNF!

I'd prefer a link with some trig eqns, or perhaps just a reply on how to do it .. I know it can't be that difficult

Thanks,
sixb0nes
www.xpression.org

Edited by - sixb0nes on August 13, 2000 10:01:10 AM
sixb0neshttp://www.xpression.ca
Advertisement
cam->LocX -= sin((cam->Yaw + dangle) * (M_PI180)) * cos((cam->Pitch + dangle) * (M_PI180)) * dsize;
cam->LocZ -= cos((cam->Yaw + dangle) * (M_PI180)) * cos((cam->Pitch + dangle) * (M_PI180)) * dsize;
cam->LocY -= sin((cam->Pitch + dangle) * (M_PI180)) * dsize;


(I don''t know what dangle is)

GA
Visit our homepage: www.rarebyte.de.stGA
i''m assuming dangle would be delta-angle.. that is, the change in the angle (the equations would make sense that way, at least)
Greenspun's Tenth Rule of Programming: "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
ga,

Thanks for the input... working it out on paper now makes sense.

sixb0nes
www.xpression.org
sixb0neshttp://www.xpression.ca

This topic is closed to new replies.

Advertisement