Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Calculating Angles from x,y co-ordinates

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Oct 2003 21:25
Hi!

I was wondering if anyone could tell me a way to calculate angles from x,y co-ordinates?

For example: If obj was moving 10 places along the x axis and zero on the Y axis then obj would be travelling at 90 degrees. Similarly if obj was moving 10 places along the x axis and minus 10 along the y axis then obj would be travelling at 45 degrees.

That's easy but is there a way to calculate these angles and any others just from the amount of movement along each axis?

Thank you

P.S. I am, of course, talking about 2D only.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 28th Oct 2003 21:43
Found this on my drive, author unknown



If your mansion house needs haunting, just call Rentaghost!
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Oct 2003 21:48
Thanks spooky

ATANFULL might do the trick I think.

Thanks
Magpie
21
Years of Service
User Offline
Joined: 16th Jul 2003
Location: Otherland! Cos it rocks!
Posted: 28th Oct 2003 21:56
AHATFUL Of Ghosts
Magpie
21
Years of Service
User Offline
Joined: 16th Jul 2003
Location: Otherland! Cos it rocks!
Posted: 28th Oct 2003 21:58
Can you do it backwards? Like find the x and y stuff from the angle value itself? I'm working on a breakout game called Blockout 2004.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Oct 2003 22:01
Quote: "AHATFUL Of Ghosts"


Is that along the lines of SOHCAHTOA? If so, what does it stand for?

Sin=Opp/Hypoteneuse
Cos=Adj/Hypoteneuse
Tan=Opp/Adj


BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Magpie
21
Years of Service
User Offline
Joined: 16th Jul 2003
Location: Otherland! Cos it rocks!
Posted: 28th Oct 2003 22:31
I know SOHCAHTOA but I think ATANFULL is something different.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 28th Oct 2003 22:49
@Helix

NEWXVALUE and NEWYVALUE might be what your looking for.
Northern Fist
20
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 29th Oct 2003 17:44
Scraggle is correct, look into those keywords - they will make your like easier...

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)

Login to post a reply

Server time is: 2024-09-21 07:45:17
Your offset time is: 2024-09-21 07:45:17