The Daily Click ::. Forums ::. Klik Coding Help ::. ATan2 but not ATan2
 

Post Reply  Post Oekaki 
 

Posted By Message

nim



Registered
  17/05/2002
Points
  7234
18th August, 2009 at 00:49:00 -

What's the alternative formula for ATan2? Like, not ATan2 but does the same thing (angle between two points). Cheers.

 
//

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
18th August, 2009 at 01:06:51 -

Basically, you're going to be a lot better off just using the advanced direction extension for this.
If for some weird reason you absolutely *must* do it without extensions, the expression is this:

Angle = Abs(360*Min(Max(Y( "Point A" )-Y( "Point B" )+1, 0), 1)-(ASin((X( "Point B" )-X( "Point A" ))/Sqr((X( "Point A" )-X( "Point B" )) pow 2+((Y( "Point A" ))-Y( "Point B" )) pow 2))+270))

Clickteam really need to add ATan2 to all their current products, if they haven't already (not sure I have the latest build). Maybe if enough people email them or post on the clickteam forums...




 
n/a

nim



Registered
  17/05/2002
Points
  7234
18th August, 2009 at 01:10:58 -

Thanks

 
//

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
18th August, 2009 at 01:11:56 -

I'm sure I used ATan2 today to work out the angle between 2 positions. I'd check but I'm on a wild computer at the mo.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

nim



Registered
  17/05/2002
Points
  7234
18th August, 2009 at 10:37:06 -

I also have MMF2 HWA build#4 and ATan2() works. I think they're on build#6 now.

 
//

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
18th August, 2009 at 10:40:33 -

isn't atan2(x,y) just atan(y/x)?
You just have to use a little trickery depending on what quadrant you're in, so a few if statements

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
18th August, 2009 at 12:21:41 -

Well incase it matters this works ATan2(x1-x2, y1-y2), or it least in the situation I need it to (set the angle of a nearby object to look at another).

Edited by Dr. James MD

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
18th August, 2009 at 13:10:12 -

Ah, that's good then - sounds like I need to update.
I know for a long time the standard version had ATan2, but the HWA version didn't, though.

 
n/a

Battenburg



Registered
  24/04/2009
Points
  13
23rd August, 2009 at 21:44:06 -

Another stupid question by me, how do you tell which build you concurrently have?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
24th August, 2009 at 11:28:51 -

help -> about
(or just look at the loading screen when you start MMF2)

It'll say something like "Version 2.0 (Build R249)"

Unless you downloaded it yourself, you won't have the HWA version.
However, it's well worth downloading, and it doesn't actually replace the standard version, so you can use both on the same computer.



 
n/a
   

Post Reply



 



Advertisement

Worth A Click