Author Topic: HUD Text curves  (Read 3469 times)

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
HUD Text curves
« on: August 11, 2014, 03:05:00 PM »
Hi,

Just making a new thread to keep it separated as it is a completely different question... but... how exactly do the curves on HUD text work? I mean, Offset, Alpha and Scale curves?

I've been toying around with them but it does not seem like they are being obeyed in a logical way lol... so first and foremost, I suppose the axis are:

For Offset:
Y = Pixels
X = Time

For Alpha
Y = Inverse of Alpha (1 = invisible, 0 = visible)
X = Time

For Scale
Y = Value
X = Time

Is that correct?

Assuming that it is... on the Offset curve one of the problems I have is that I made a simple, linear curve from 0 to -40 during 3 seconds, but the displayed text for some reason is still floating up instead of down... how??

For the alpha curve, did I get it right, is it the inverse of what is expected, like 0 alpha actually means 100% visible? Also, I made a curve that starts and ends on 0 but apparently after the curve is through, the code assumes and make another fade out... does that make sense? Like, my curve ends on 1, and in the game the text apparently follows the curve and in the end when it should be invisible, it turns visible again and then fade out again... is this the expected behaviour?

No problems with the scale curve gladly =P

Anyway, thanks for the attention,
Best regards,
Allan

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: HUD Text curves
« Reply #1 on: August 11, 2014, 04:11:56 PM »
Okay I think I got part of it... the value we send on the Add() call is actually how long it should stand still, before the curves are considered... and the length of the text is actually the size of the biggest curve... hmmmm now Im beginning to understand... =P

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: HUD Text curves
« Reply #2 on: August 11, 2014, 04:54:42 PM »
Okay got another part of it... there is a "Mathf.Max(offset, ent.offset)" which prevents the offset from being negative...

Another question though, what should I change if I want new texts to push older texts down, instead of up?

I tried changing:

offset += Mathf.Round(ent.label.cachedTransform.localScale.y * ent.label.fontSize);

to:

offset -= Mathf.Round(ent.label.cachedTransform.localScale.y * ent.label.fontSize);

Based on a bool value, but didnt work, its not pushing older texts up, but its not pushing down either...

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD Text curves
« Reply #3 on: August 12, 2014, 07:49:47 AM »
Alpha curve's Y should be directly corresponding to alpha. The default frames are (1, 1) and (3, 0), meaning from 0 to 1 time (X) it's at 100% alpha (Y), then fades slowly to 0 from 1 to 3 seconds (X).

For the last question... the labels stack so that the newer one is below the older one, but in a way that the older one is pushed up. This is done in the Update() function at the very bottom of the HUDText.cs file as you've discovered, however I'm not sure why you are modifying the offset. It's the local position above it that you should be modifying.
  1. ent.label.cachedTransform.localPosition = new Vector3(0f, -offset, 0f);