Modding Help WeaponOffset: how /does/ it work?

Discussion in 'Starbound Modding' started by Marinebeast, Aug 11, 2016.

  1. Marinebeast

    Marinebeast Existential Complex

    This is more of an affirmation than an actual question, I suppose, because ingame testing is mysterious and doesn't always work the way I want it to. Sorry for all the questions, really! ; w ; I'm still learning.

    So, WeaponOffset / MuzzleOffset. Tell me if my understanding is wrong, or there's something I'm missing here?


    - The first value is the x value. Increasing it moves the weapon up in the character's hands; decreasing it below 0 moves it down. A value of 1.2 would nudge the weapon up by ~10 pixels.

    - The second value is the y value. Increasing it moves the weapon forward in the character's hands; decreasing it below zero moves it backwards. A value of -0.5 moves the weapon backwards by 4 pixels.

    - "1" = an 8 by 8 pixel block, since the game really likes measuring in blocks of eight.


    So a weaponOffset of [-1, 2] would have the weapon nudged eight pixels down and sixteen pixels forward. Right?
     
  2. Nirrudn

    Nirrudn Void-Bound Voyager

    It's so mysterious even the developers don't seem to know exactly how it works. From weapon.lua, there's a funny comment on line 11:

    newWeapon.aimOffset = config.getParameter("aimOffset") or (newWeapon.muzzleOffset[2] - 0.25) -- why is it off by 0.25? nobody knows!
     
  3. CynicalToffie

    CynicalToffie Scruffy Nerf-Herder

    You have it a bit backwards in a 2d plane the x value is your horizontal axis (left and right) and the y value is vertical (up and down)

    so in actuality [-1,2] would move the weapon 8 pixels back (left) and 16 pixels up

    1 block is 8 pixels so if you want to move something by 1 pixel it would be 0.125

    so for reference

    0.125 = 1 pixel
    0.25 = 2
    0.375 = 3
    0.5 = 4
    0.625 = 5
    0.75 = 6
    0.875 = 7
    1 = 8
     
  4. Marinebeast

    Marinebeast Existential Complex

    That's absolutely hilarious that even they don't fully understand. I can't blame them at all.

    But thank you! I was sort of just firing in the dark in hopes of figuring it out, but now I know-- and that's awesome! I don't know nearly as much about algebra as I probably should (it's been a long time, haha), so the help is super appreciated.
     
  5. CynicalToffie

    CynicalToffie Scruffy Nerf-Herder

    No problem
     

Share This Page