Vector to Angle

jimmyraynorjimmyraynor Member Posts: 22
edited November -1 in Working with GS (Mac)
What is the vector to angle mathematical function? How does it work?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    VectorToAngle gives you the angle between two points.

    It works like this:

    myAngle = vectorToAngle(Actor1.X - Actor2.X, Actor1.Y - Actor2.Y)

    Let's say you wanted Actor 1 to fire a bullet at Actor 2. You would use this formula to find the angle of trajectory.

    Let's say you wanted Actor 1 to fire at the Mouse cursor position, you would do this:

    myAngle = vectorToAngle(Actor1.X - Mouse.X, Actor1.Y - Mouse.Y)

    It can be used for a great variety of things, but hose are some basic uses...
  • AfterBurnettAfterBurnett Member Posts: 3,474
    firemaplegames said:but hose are some basic uses...

    Please explain the hose thing :P
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    POLYGAMe said:
    Please explain the hose thing :P

    You're gonna get a slap, I can tell... :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tom.tomtom.tom Member Posts: 22
    is vector to angle an attribute tthat you add?
    Or is it one of the behaviours?

    confuseddd.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    It's in the Expression Editor. Some of the Rules and behaviors have a little 'e' button. Click that to open the editor. VectorToAngle is located in the 'insert function:' drop down in the expression editor.

    Check out the Support Section up above. Especially the Reference Library. It explains the Expression Editor in-depth.
  • pjnolenpjnolen Member Posts: 152
    firemaplegames said:
    VectorToAngle gives you the angle between two points.

    It works like this:

    myAngle = vectorToAngle(Actor1.X - Actor2.X, Actor1.Y - Actor2.Y)

    Let's say you wanted Actor 1 to fire a bullet at Actor 2. You would use this formula to find the angle of trajectory.

    Let's say you wanted Actor 1 to fire at the Mouse cursor position, you would do this:

    myAngle = vectorToAngle(Actor1.X - Mouse.X, Actor1.Y - Mouse.Y)

    It can be used for a great variety of things, but hose are some basic uses...

    shot in the dark diggin up this thread, but I'm trying to do this very thing.
    Which Behavior do I use to have npc1 shoot a bullet at player1. I've got a constrain for player1 x and y, but no matter which behavior i use the bullet seems to either freeze the screen to fire upwards no matter where the player is. Some of the Behaviors have 1 E and some have 2, which would i use for this type of expression?
Sign In or Register to comment.