User Tag List

Results 1 to 4 of 4

Thread: Rotation is off center

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2016
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Rotation is off center

    So I'm using the following code to draw a line from one object to another:

    Always:
    Set object "Line" X Scale to "Distance(X( "A" ), Y( "A" ), X( "B" ), Y( "B" ))"
    Set object "Line" angle to "ATan2(Y( "A" ) - Y( "B" ), X( "B" ) - X( "A" ))"

    The problem is when aiming any direction other than right, the line becomes slightly off center as you can see in the image below. I want the start of the line to always be attached to the white pixel in the center of the blue box and the end of the line to always be attached to the other white pixel. I've attached an example of the problem. Any ideas?
    Images attachées Images attachées
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    570
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I believe this is due to an oddity in the way Fusion angles objects; they will be offset from center slightly at certain angles, even if the math is correct.

    If you'll be doing a lot of drawing, the surface object is nice: offcenter line-2.mfa

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2016
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome thank you! This will do. If anyone is aware of a way of doing this without the surface object I would like to avoid extensions, but if not this way works fine.
    One question about this surface object though. Is there any way to distinguish different lines with different events within the same surface object? Like if I wanted one line for line of sight detection and another line for hitscan detection, could I have them both within the same surface or would I need two surface objects for that? If the latter, how performance friendly is it to have multiple? Not that I need to, but would it be feasible to have like a dozen surface objects at the same time or would that kill performance?

  4. #4
    Clicker Fusion 2.5
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    570
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Having many surfaces objects would kill performance. A trick you can use to distinguish lines: clear the surface before every line draw. I.e:

    Always:
    -draw line for sight detection

    Surface is NOT overlapping backdrop:
    -set line of sight to yes

    Always:
    -clear surface
    -draw line for hitscan detection

    Surface IS overlapping target:
    -set hit to yes

    Always:
    -clear surface

Similar Threads

  1. Replies: 0
    Last Post: 9th May 2018, 01:35 AM
  2. Any way to do bit rotation?
    By EE in forum Fusion 2.5
    Replies: 4
    Last Post: 28th February 2017, 11:34 PM
  3. No more rotation???
    By KLiK-iT in forum Android Export Module Version 2.0
    Replies: 12
    Last Post: 22nd December 2013, 05:53 PM
  4. 360 Rotation?
    By Ausomeman in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 1st January 2011, 09:37 PM
  5. Rotation
    By Almightyzentaco in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 27th April 2008, 07:45 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
  •