robhol Posted June 15, 2008 Posted June 15, 2008 I need a function like this: float float getXYInFrontOf(float x, float y, float rotation, float distance) Anybody got it handy? Thanks in advance. (I hate trigonometry, I hate trigonometry, I hate trigonometry.)
eAi Posted June 15, 2008 Posted June 15, 2008 Off the top of my head: x2 = x + cos(rotation) * distance y2 = y + sin(rotation) * distance
tma Posted June 15, 2008 Posted June 15, 2008 A couple of lines from my code: local tx = x - math.sin(math.rad(rz)) * radius local ty = y + math.cos(math.rad(rz)) * radius Where rz is your rotation in degrees e.g. from getPlayerRotation()
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now