Results 1 to 3 of 3

Thread: Excessively precise but inaccurate numbers in the JSON file

  1. #1

    Angry Excessively precise but inaccurate numbers in the JSON file

    Is there a reason why TTS has difficulty using rounded numbers in the JSON file? Even after I hand edit the JSON file and correct the numbers, TTS changes them back:

    "Name": "Infinite_Bag",
    "Transform": {
    "posX": 23.0444183,
    "posY": 0.9442168,
    "posZ": -28.7585812,
    "rotX": -2.83640674E-07,
    "rotY": 9.91833247E-08,
    "rotZ": 9.97576E-08,
    "scaleX": 1.0,
    "scaleY": 1.0,
    "scaleZ": 1.0
    },

    E-07? Seriously? rotX, rotY, and rotZ are all supposed to be 0. If I change these values to 0, load the game into TTS, and then save it again, TTS will change these values back to some random number that's almost 0.

  2. #2
    yeah, it's weird. Something to do with the fact that it's a Physics engine, I bet.

    But it's not really a problem. You shouldn't be comparing floating points numbers for equality anyway. (0.1 + 0.2 isn't equal to 0.3, after all.)

    Use something like

    Code:
    math.abs( x - y ) < tolerance

  3. #3
    This is normal behavior. They are floating point errors: https://www.microsoft.com/en-us/microsoft-365/blog/2008/04/10/understanding-floating-point-precision-aka-why-does-excel-give-me-seemingly-wrong-answers/

    It should not affect the gameplay math in any noticeable way. There are ways to mitigate it but ultimately in a game like this it probably wouldn't be worth the effort.

Similar Threads

  1. More precise rotation without using the Rotator tool?
    By MarcusRaven in forum Suggestions
    Replies: 6
    Last Post: 12-30-2020, 04:28 PM
  2. Spelling error within code of save file .json
    By TheRaven81 in forum Bug Reports
    Replies: 1
    Last Post: 12-03-2020, 05:35 PM
  3. JSON.decode a large JSON string takes forever
    By Xorbis in forum Scripting Bug Reports
    Replies: 7
    Last Post: 04-26-2020, 06:59 PM
  4. [ADDED] [v4.2] Set mass values for dice in Json file
    By Kragin in forum Suggestions
    Replies: 2
    Last Post: 06-28-2015, 05:59 PM
  5. Inaccurate Piecepack Anatomy
    By MattDamonUniverse in forum General Discussion
    Replies: 1
    Last Post: 04-05-2014, 10:23 AM

Tags for this Thread

Posting Permissions

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