User Tag List

Results 1 to 5 of 5

Thread: Impairing turret angle

  1. #1
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    EE's Avatar
    Join Date
    Sep 2009
    Posts
    200
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Impairing turret angle

    Hi y'all, what's cookin'!?

    I'ma cookin' tanks & turrets!

    My little problem is that I'm having some trouble detecting if a target is within "angular proximity" to the turret.

    The turrets can point in any angle that is within the tank's directional angle(0-360) +45/-45.

    My question being, what would be the proper way to determine if an object is within +-45 degrees from the tank's angle?

    The shifting nature of what is considered angle=0(up or right) is totally messing with my head.

    //EE


    Edit: Solved it! (Compare two general values)
    +Abs(((TargetAngle-TankAngle+540) mod 360)-180) <= 45

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Impairing turret angle

    The angle 0 is right, always. Cosine determines X and sine determine Y, cos(0)=1, sin(0)=0, so you're left with a horizontal line which goes towards the right.

    The problem you'll encounter is that in MMF2, angles go from 0 to 360. Now an angle of 5 is within 45 degrees of 355, but the problem is determining that. I have done it several times, but I don't believe I have an example on hand. I'll try to redo it and repost it.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Impairing turret angle

    Here ya go!

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=230455

    Any questions, ask here, or PM me, I don't care.

    EDIT: This is embarassing. I didn't even see you solved it. *facepalm* Well I had a different solution so you can look at it if you want x) But I think I've used your solution as well and it's worked for me. I recall doing it in one line for one of my cannon games.

  4. #4
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    EE's Avatar
    Join Date
    Sep 2009
    Posts
    200
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Impairing turret angle

    Thanks for the effort!

    Perhaps I should start putting my edits in the beginning?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Impairing turret angle

    Nah don't do that, that's just confusing. Perhaps I should read more carefully.

Similar Threads

  1. Turret AI
    By Pixzel in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th June 2011, 03:01 AM
  2. RTS Turret simulator ext.?
    By legocacher in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 5th April 2010, 11:20 PM
  3. Turret
    By nick_Peoples in forum The Games Factory 2 - Technical Support
    Replies: 11
    Last Post: 3rd December 2009, 08:49 PM
  4. N-Like Guass Turret
    By LB in forum File Archive
    Replies: 0
    Last Post: 2nd January 2009, 06:40 PM
  5. Tank turret
    By Robin_Manager in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 18th August 2008, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •