playMaker

Author Topic: Set Scale over time? Player Health Bar  (Read 134 times)

shack

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Set Scale over time? Player Health Bar
« on: April 03, 2019, 01:25:12 PM »
Is there an easy way to do this? I have a health bar (cube) attached to an empty object (acting as a pivot/rotation point) and want the object to slowly decrease in scale over time. Is there a way to do this?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4360
    • View Profile
    • jinxtergames
Re: Set Scale over time? Player Health Bar
« Reply #1 on: April 03, 2019, 02:25:02 PM »
Hi,
if it is a 3D object, then you need to make a cube in Blender or any other 3d software and set the pivot point on 1 side.
the standard cube has the pivot centered wich makes it difficult to do the scaling.

to calculate the % (set between 0 and 1) use a float operator and set in Float 1 the Current Heath.
Then in Float 2 the Total Health and Divide.
now you have a result between 0 and 1

You can use that to set the scale.

if you wold use a UI Image you can also use UI Image Set Fill Amount.
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions