FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.73k stars 402 forks source link

buying weapons to scaled hardpoints has bad placement #9589

Open Tsunder opened 2 years ago

Tsunder commented 2 years ago

Disclaimers

What happened?

Scaled weapon purchase seems to be offset incorrectly.

90 degrees rotated, 0.3 scale hardpoint

image

railgun aftter purchase: image

default scaled hardpoint resulted in non-buggy behaviour, although the it's a bit too big to fit, hence trying to scale the hardpoint down image

Reproduction steps

  1. 90 degrees rotated, 0.3 scale hardpoint
  2. purchase a weapon. I chose railgun because it's big.
  3. go to new level to apply changes

Bug prevalence

Happens every time I play

Version

0.18.12.0

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

Regalis11 commented 2 years ago

Fixed in https://github.com/Regalis11/Barotrauma-development/commit/e9f7ccf8895075fdffa5e2e33b4d9203ad488a65

NilanthAnimosus commented 2 years ago

Tested on 0.19.0.0, not sure if this is working as intended or if there are substantial differences between weapon types:

Before switching weapons (using one micro, one standard size and one supersized weapon): image

After swapping all three: image

Barsuk turret scale test.zip

Regalis11 commented 2 years ago

Reverted the commit for now https://github.com/Regalis11/Barotrauma-development/commit/968c3ac777a9148c294703382d32b64fae8bfad8, need to rethink the calculations in a way that works when the new item has different dimensions than the old one.

Ek-Videogames commented 2 years ago

Reverted the commit for now Regalis11/Barotrauma-development@968c3ac, need to rethink the calculations in a way that works when the new item has different dimensions than the old one.

Perhaps use hardpoint position origin as the frame of reference instead of the sprite sourcerect & origins?

Regalis11 commented 1 year ago

Perhaps use hardpoint position origin as the frame of reference instead of the sprite sourcerect & origins?

We don't use the sprite sourcerect or origin to calculate it, but the position of the hardpoint origin. The issue is in the way the position of the origin is calculated on scaled and rotated items.