Having problems with cos and sin (figured out)
Posted: Tue Apr 15, 2014 5:19 pm
I am currently working on a collision detection system an i ran into a problem when i tried to detect if a pos is inside a rotated line
the one fro the y axis works fine but the one for the x axis wont work:
and also one more question why is cos returning 1 when the angle is 0 and sin returns 0
woops i just relized that i did a spelling mistake second line in the code is not sin but cos so i stil need help
the one fro the y axis works fine but the one for the x axis wont work:
Code: Select all
--y: v.pos.y - math.sin(v.pos.r) * (v.pos.x-self.pos.x) < self.pos.y
--x: v.pos.x + math.cos(v.pos.r) * (v.pos.y-self.pos.y) < self.pos.x
woops i just relized that i did a spelling mistake second line in the code is not sin but cos so i stil need help