I’m trying to implement floating damage numbers and I’ve implemented the following example, but the damage numbers move with the player. I want them to stay where they were when initially rendered. Is that not possible with screen space UI elements?
Initially I was using widget components and attaching one on damage, but those move with the AI. I just want them to stay where they were initially rendered. Does anyone have any ideas on how to implement this properly?
So a widget component in world space instead of screen space? I tried that, but had issues getting it to display on top of everything properly; maybe I’m missing a setting somewhere to fix that? Screen space just follows my screen as I move.
widget components in Screen Space are z-sorted automatically and follow their actors:
But since it’s screen space, they render on top of any geometry.
they’re also z-sorted in World Space mode, ofc:
But the quads they render on do not rotate to face the camera. There’s a couple of ways to make this happen, ofc.
You can also disable occlusion:
I tried that, but had issues getting it to display on top of everything properly; maybe I’m missing a setting somewhere to fix that? Screen space just follows my screen as I move.
Perhaps you could demo the undesired behaviour and produce and example of how you’d like to them to behave?
If you did not want to use a widget component, the actor can shift them around with something similar to this pseduoscript:
I know. I don’t want them to. I want to display the floating damage numbers above the actor that was hit, but I don’t want them moving with the actor.
Basically I just want the damage numbers to float above the actor at the point of impact. If that actor moves I do not want the damage numbers moving with them, which is the case for my floating healthbars and is the desired result. I guess I could make the numbers fade even faster so it’s not too noticeable that they’re moving with the hit actor, but still feels weird.
Would using World based instead of Screen based widget be the solution here? My only issue with World based is it didn’t have the z-sorting that screen space has or I could have missed that configuration somewhere.
I tried this and the numbers move on the screen as the player moves.
Decided to just stick with attaching widget components. Once I added some movement to it it’s fine that it follows the hit actor. Below is what I have.