User Tag List

Results 1 to 10 of 10

Thread: Look at Coordinate without having an object

  1. #1
    No Products Registered

    Join Date
    Dec 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Look at Coordinate without having an object

    Im trying to make it so that you can have objects who will look at the coordinates stored in their own alterable values so that each of this object can have it's own destination.

    The mouse sets the coordinates to where the objects are supposed to look at, and all my attempts, even getting help from some math teachers, the direction that comes out isnt helpful.

    Is there anyone who can help me out here?

  2. #2
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    Sure its easy.

    + On mouse click
    - Set alt value x to xmouse
    - Set alt value y to ymouse

    + Always
    - Look at direction xvalue, yvalue

  3. #3
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    I'm pretty sure you can't enter expressions for the "Look in direction" action. If there isn't this should work instead:
    Code:
    * Always
    - Object: Set Direction to Atan2(Stored_Y("Object") - Y("Object"), Stored_X("Object") - X("Object")) / -11.25
    Alternatively you can set the angle, in that case just remove the /-11.25 part.

  4. #4
    No Products Registered

    Join Date
    Dec 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    Yea, it doesnt allow you to look at values as coordinates,
    and i've tried that formula but not like that, Atan yes, but what is Atan2?
    and what is your choice for /-11.25, i used positive,
    but i dont know if that would make a big difference.
    Thank you very much for the help!

  5. #5
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    Atan2 takes an Y and an X value and returns the angle. Atan takes a Y/X ratio and requires a lot more work to use properly.

    Angles have 360 steps, directions have 32, so you have to divide the angle by 360/32 = 11.25 to get it as a direction. The minus sign is there as (if I recall correctly) Atan2 returns a clockwise angle while directions are counterclockwise.

  6. #6
    No Products Registered

    Join Date
    Dec 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    Ahhh! i saw that but i didnt know it did all that, Thank you very much!
    so the negative 11.25 or positive 11.25 doesnt seem to matter very much for a simple situation then?

  7. #7
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    The difference will be that the object will look up when the target is below it if you swap the sign.

  8. #8
    No Products Registered

    Join Date
    Dec 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    so then negative is the way to go then?

  9. #9
    No Products Registered

    Join Date
    Dec 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    Hmmmm, It seems so close,
    they're facing away from the target coordiates,
    no longer in odd patterns,
    but it seems theres one thing missing.
    My code section is
    Code:
     Object:SetDirection = ATan2((Y( "Active" )-Y Dest( "Active" )), (X( "Active" )-X Dest( "Active" )))/-11.25

  10. #10
    No Products Registered

    Join Date
    Dec 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Look at Coordinate without having an object

    Never Mind =) I swiched the value's positions and it works perfectly. Thank you very much for your help!
    Total Success!~

Similar Threads

  1. save coordinate clone object. Very important
    By daniele in forum File Archive
    Replies: 6
    Last Post: 8th August 2011, 01:27 AM
  2. Save coordinate x-y for more clone object
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th August 2011, 07:34 PM
  3. set coordinate expression bug
    By SoftWarewolf in forum SWF/Flash Export Module Version 2.0
    Replies: 3
    Last Post: 11th May 2010, 09:42 PM
  4. Check if x/y-coordinate is overlapping an object?
    By the_raven in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 5th April 2009, 11:09 AM
  5. Coordinate to test?
    By BrandonC in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th August 2006, 10:05 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
  •