Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this.
-
henrik9864
- Prole
- Posts: 11
- Joined: Mon Sep 02, 2013 3:58 pm
Post
by henrik9864 »
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:
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
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
Last edited by
henrik9864 on Thu Apr 17, 2014 9:23 pm, edited 2 times in total.
-
Karai17
- Party member
- Posts: 930
- Joined: Sun Sep 02, 2012 10:46 pm
Post
by Karai17 »
use math.cos for the x axis, not math.sin
Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests