Could someone please explain to me or give me a link explaining how sinus and cosinus are used in games? Definitions, pictures etc. I'm mainly talking about this:
- Code: Select all
px = sin(double (proty * irr::core::DEGTORAD)) * playerspeed;
pz = cos(double (proty * irr::core::DEGTORAD)) * playerspeed;
PlayerMdl->setPosition(PlayerMdl->getPosition() + vector3df(px,0,pz));
(code for moving player forward)
Best thing would be if someone could make a paint picture showing the XY grid and px,py,prot(player rotation) as that would help me better understand the concept.
I'm writing this plead for help because, having read a few articles about sinus and cosinus and asked people in my surroundings to explain it to me, I failed miserably and I don't want to wait until university for this to be explained to me. Will anyone help me?
I'm also not sure what a DEGTORAD is doing there.