Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Scaling static mesh with blueprint


I am trying to make a static mesh shrinking/scaling down only on the Z axis.

It is suppose to be a healthbar but instead of using a widget i need it to be a static mesh that will shrink when the health is being deducted. I have my health system fully set and have tried scaling the static mesh myself but as soon as the game starts the mesh gets distorted into a cube and literally scales down on each axis when damage is inflicted to it.

here is a screenshot of how far I have gotten, any more information needed please let me know.alt text

Product Version: UE 4.14
3dhealth.png (195.8 kB)
more ▼

asked Mar 07 '17 at 01:23 PM in Blueprint Scripting

avatar image

60 17 16 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Try this:

alt text

You were scaling it on all axis. This is assuming your health bar is scaled to 1,1,1 at the start though, if not, adjust the numbers.

Also, you don't really need to do that on tick, you could just scale it whenever there is damage instead.

health.jpg (117.2 kB)
more ▼

answered Mar 07 '17 at 01:46 PM

avatar image

1.8k 49 22 67

avatar image KebabCritic Mar 07 '17 at 02:11 PM

Hi, for some reason the cube fully dissapears after it gets hit once. I have 500 healthpoints and the enemy inflicts 100 damage so i would like the cube to shrink 1/5 each time it gets hit if that makes sense?

avatar image Mosel3y Mar 07 '17 at 02:36 PM

Make sure the starting scale of your Health mesh is 1 on all axis. Make sure the default value of TowerHealth is set to 500, and that you are applying 100 damage.

alt text

health2.jpg (255.6 kB)
avatar image KebabCritic Mar 07 '17 at 02:53 PM

okay now were getting somewhere :D the problem that I have now is it rescales from bottom and top towards the middle.. how do i lock it so it only scales from top to bottom?

avatar image Mosel3y Mar 07 '17 at 02:57 PM

It will scale around the pivot of the mesh. So, at the moment the pivot is probably at the center. You will have to edit the mesh in whatever program you used to model it. Move the model up so that the base of the mesh is on 0 (so that the bottom of your model is lined up with the lower axis, or "floor") and then re-export and import your mesh again.

avatar image KebabCritic Mar 07 '17 at 03:20 PM

Works exactly as I wanted now :)!! Thank you very much for your efforts and for baring with my beginner skills :D

avatar image Arty-McLabin Mar 07 '17 at 10:10 PM

[to asker] actually that seems to be your problem, i didn't notice that wrong conversion you have made from float to vector. try this way before the one i have supplied :P

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

try using SetTransform, and break the input transform struct (right click -> break struct), then you should have a scale input in there.

more ▼

answered Mar 07 '17 at 01:26 PM

avatar image

919 21 46 64

avatar image KebabCritic Mar 07 '17 at 01:39 PM


is this what you meant? the static mesh is not present when I now press play at all..

alt text

I need the cube to shrink from top to bottom as my health points get lower alt text

3dhealth2.png (103.3 kB)
3dhealth3.png (47.3 kB)
avatar image Arty-McLabin Mar 07 '17 at 01:49 PM

it doesn't show up, because you didn't plug anything to "new location" and "new rotation", so it gets 0,0,0 input for each, which places it in root location (X:0 Y:0 Z:0) of your world. plug the current location and rotation to these inputs to avoid it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question