nanos-world / issues

Issue Tracker for nanos world
9 stars 1 forks source link

Multiple `Billboard` issues #988

Open Timmy-the-nobody opened 10 months ago

Timmy-the-nobody commented 10 months ago

Prerequisites

Your Environment

Description

There's 2 problems with the Billboard class, both coming from the class constructor

1: size issue:

When dealing with X and Y in Vector2D to express a size you'd expect X to be the width and Y the height, but in the size parameter they're inverted

2: size_in_screen_space issue:

This parameter makes the width/height of the billboard relative to the width/height of the viewport It is not ideal since results will differ depending of your viewport ratio (16:9, 4:3, etc..) To prevent this the size should only be relative to the viewport height

Steps to reproduce the behavior

1st issue:

Billboard(Vector(), "nanos-world::M_Default_Masked_Unlit", Vector2D(10, 10), false) image

Billboard(Vector(), "nanos-world::M_Default_Masked_Unlit", Vector2D(10, 5), false) image

2nd issue:

Let's make a billboard that have 10% of the screen size Billboard(Vector(), "nanos-world::M_Default_Masked_Unlit", Vector2D(0.1, 0.1), true)

With a 16:9 ratio (1920x1080), it'll look like this image

While in 4:3 ratio (1024x768) it'll look squarer image

Expected behavior

1st issue:

X/Y of the size parameter should be width/height (instead of height/width)

2nd issue:

The billboard w/h with size_in_screen_space should only be relative to the viewport's height

Actual behavior

1st issue:

The width/height parameters are inverted

2nd issue:

The billboard w/h with size_in_screen_space is relative to the viewport width/height

gtnardy commented 9 months ago

weirdly there's no bug in the code 🤔 the X is being set as the X and the Y in the Y properly

all the behavior you are seeing is caused by unreal the ratio stretching is a expected behavior when using "SizeIsScreenSpace" as it will get relative to the resolution.

Timmy-the-nobody commented 9 months ago

weirdly there's no bug in the code 🤔 the X is being set as the X and the Y in the Y properly

Well then it's a weird choice to put X for height and Y for width

all the behavior you are seeing is caused by unreal the ratio stretching is a expected behavior when using "SizeIsScreenSpace" as it will get relative to the resolution.

Allright, will keep doing (billboard height * (viewport width / viewport height)) when dealing with responsive sizes then 🤷‍♂️