User Tag List

Results 1 to 5 of 5

Thread: [Bug Report] Value error after interpolation

  1. #1
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    643
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    [Bug Report] Value error after interpolation

    Hello,

    I know that there are several floating-point number precision errors in Fusion already. I'm not sure if this is quite the same as those.

    I'm using linear interpolation to seek a target active for my camera system. There isn't any issue with the movement itself; it performs exactly as expected for the most part. The problem is when I try to compare the "pos" positions (the values I make track the player) to anything. For example, when xtarget = xpos and ytarget = ypos then set a counter to 1. Looking in the debugger after movement, both pos values will be equal to their targets, but the counter never sets to 1. A screenshot of what I mean:

    EF0tmWO.png

    You can clearly see the values are equal to each other, but the counter won't set to 1. I thought maybe there might be trailing floats even though it is displaying ints, so i tried xtarget = int(xpos) and same for y to see if that fixed it, but still nothing. Comparing to Round(pos) fixes it, but this results in false positives for the condition when the camera has't actually reached the target and isn't desireable. You'll also notice looking at the debugger that the xvel and yvel values will go haywire even when the object is at the target and should no longer be using them. I'd like some insight into why this might be happening!

    cam rounding bug.mfa

  2. #2
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jan 2015
    Location
    Australia
    Posts
    166
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    You're correct in your analysis - xPos and yPos are floating point values being compared to x/yTarget's ints

    The remainder disappears after standing still for a while but during movement and a few seconds after I can see them



    Easiest solution I can think of is checking to see if the difference between the two values is lower than some threshold (e.g. 0.1) rather than seeing if they are the same value



    cam rounding bug 2.mfa

  3. #3
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    643
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    @marbenx during movement they will be floats; the value will smoothly ease towards target before settling. the problem is that they eventually settle and display integers but the condition still won't fire.

  4. #4
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jan 2015
    Location
    Australia
    Posts
    166
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by casleziro View Post
    @marbenx during movement they will be floats; the value will smoothly ease towards target before settling. the problem is that they eventually settle and display integers but the condition still won't fire.
    While they display integers values, they are still floats, with values like 258.00000000000000000001 or something along those lines. I imagine once the decimals are small enough the debugger in Fusion omits them so they appear to be integers even though they are still floating point numbers

  5. #5
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,081
    Mentioned
    122 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by marbenx View Post
    While they display integers values, they are still floats, with values like 258.00000000000000000001 or something along those lines. I imagine once the decimals are small enough the debugger in Fusion omits them so they appear to be integers even though they are still floating point numbers
    I confirm this is what happens. You should compare xtarget and ytarget with Round(xpos( "camera" )) anf Round(ypos( "camera" ))

Similar Threads

  1. New error report appeared since I built my app with version 292.4
    By Nemeean_lion in forum Android Export Module 2.5
    Replies: 42
    Last Post: 18th June 2019, 03:02 PM
  2. Replies: 15
    Last Post: 16th May 2016, 01:50 AM
  3. error report
    By willow in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 17th May 2011, 03:59 PM
  4. Interpolation Object
    By Sam_Dillard in forum Extension Development
    Replies: 2
    Last Post: 19th December 2006, 05:54 AM

Posting Permissions

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