VectorToAngle right or wrong

hi all,

Just having a little problem with the "VectorToAngle" function. Please tell me if I have this right:

Within the Rotate to Angle (Ignore the spaces just to make it easier to read):

VectorToAngle (game.turretX - game.TargetX , game.turretY - game.TargetY)

I used an text output to see what angle it was giving and it was always showing a negative number....
Using the above to target an enemy as if moves past e.g. like miniClip's canyon defense turrets.

The data is being updated every 0.001 seconds.

Thank you

:)

Comments

  • _DNA__DNA_ Member Posts: 9
    Its just difficult to find a lot of documentation. I've searched through a lot of forums posts, but there are always specific to the question being asked.
    Is there any good resources out there?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @_DNA_ Try using an 'angle' attribute (rather than using an integer or real attribute). It will give you the full 360 degrees you want.
  • _DNA__DNA_ Member Posts: 9
    Just a quick note, still having problems with this. But for those looking into VectorToAngle, the above code was incorrect. This is the correct code:

    VectorToAngle (game.TargetX - game.turretX , game.TargetY - game.turretY)

    The target cords come first, then your cords. This has stopped the negative numbers :)

    But anyone know why my turret still isn't turning? Its driving me crazy lol

    Thanks
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @_DNA_ -- See if the attached file us useful.

  • _DNA__DNA_ Member Posts: 9
    This is almost 100% the same as what I did but your's works lol... No joke almost the same way I did it... Thank you for taking the time. I'm sure its just 1 little thing that was messing it up. Again thank you.

    Note to all looking to figure out the same problem as above, use the temp above from Rhurman!!!

    <------ Happy man
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @_DNA_ -- Glad its working for you!
Sign In or Register to comment.