Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: position the bar above the horizontal center #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

5tr1k3r
Copy link
Contributor

@5tr1k3r 5tr1k3r commented Nov 10, 2023

Resolves #24

This is what it looks like after the change:
03
04

@5tr1k3r 5tr1k3r marked this pull request as draft November 10, 2023 17:32
@5tr1k3r
Copy link
Contributor Author

5tr1k3r commented Nov 10, 2023

Nope, that actually seems wrong if the object is rotated. Looking into it further.

@5tr1k3r
Copy link
Contributor Author

5tr1k3r commented Nov 10, 2023

Nope, that actually seems wrong if the object is rotated. Looking into it further.

Seems like this happens with the original code as well: the health bar rotates with the object. I thought it would act more like a billboard.

@5tr1k3r 5tr1k3r marked this pull request as ready for review November 10, 2023 20:12
@sparten11740
Copy link
Owner

I thought it would act more like a billboard.

yeah it's supposed to, good find

@sparten11740 sparten11740 changed the title Position the bar above the horizontal center of the object fix: position the bar above the horizontal center of the object Nov 11, 2023
@sparten11740 sparten11740 changed the title fix: position the bar above the horizontal center of the object fix: position the bar above the horizontal center Nov 11, 2023
@sparten11740 sparten11740 self-requested a review November 11, 2023 06:33
@sparten11740
Copy link
Owner

We may have to rethink the offset. With the changes in this PR, dual bars would overlay each other when viewed top down. In the multi-bar scenario, the bars' positions shouldn't change relative to each other even when the camera is rotated/tilted

@5tr1k3r
Copy link
Contributor Author

5tr1k3r commented Nov 11, 2023

Yes, I've noticed that too. If viewed directly top down, they will overlap. But if there is a small angle (which is typical even in something like an RTS), and the bars have different offsets (heights), then they are both seen fairly clearly:
image

@sparten11740
Copy link
Owner

sparten11740 commented Nov 12, 2023

what do you think about having the offset supplied as a vec3 instead of f32, where the components are applied as follows:
if the camera view vector is parallel to an axis (such as top-down for the y-axis), the corresponding component in the offset vector is applied 0% (not at all). If it's orthogonal, it is applied a 100% (i.e. front view for the y-axis). You could then specify 0 for the z component of the offset vector and in your case and in the top down view the bar would be centered.

(every angle in between orthogonal/parallel would be a percentage of the rotation, i.e. 45 degrees would be 50%)

@5tr1k3r
Copy link
Contributor Author

5tr1k3r commented Nov 12, 2023

It's hard for me to say without playing around with it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offset might be wrong
2 participants