How to scale character up and down with keyboard buttons?

Hi All, i have a blueprint where i want to scale my character down and up with the keyboard buttons A and E.
( Screenshot 1 ) The A and E conditions are checked by default.

This blueprint is now setup, so that when A or E has been pressed i can’t press A or E again. I will make some changes to this. But for now let’s go on with the way it’s setup.

By default my character scale is on x1 y1 z1.

When i scale my character up with button E it works like a charm ( when my character has a scale of x1 y1 z1 i need a branch of some sort to check the scale ( Initially i don’t want to scale my character up above x1 y1 z1 )

When i scale my character down with button A my character does something weird, my camera goes to the ground of the map and i can see “under the map”. Like you can see in screenshot 2. What is the fix for this?

Now the thing is when i scale down my character, i need a branch of some sort again to check the scale ( initially i don’t want the scale to go down below x0.5 y0.5 z0.5.

I have tryed to do this with Matinee but the Matinee does not “record” the scale down or scale up of the character.

Now i was wondering if i need to duplicate my character and make the duplicate ball x0.5 y0.5 z0.5 and somehow change characters when i press A and change back to the other character when i press E? That’s not how it’s done i think.

I also want the ball to go from x1 y1 z1 to x0.9 y0.9 z0.9 and so on until x0.5 y0.5 z0.5 if it’s even possible? Is it’s possible that would be nice.

Please show some screenshots if possible :slight_smile:

Any help is welcome,

Peace

I wanted to add something more, sorry for this :slight_smile:

I also want the ball to go from x1 y1 z1 to x0.9 y0.9 z0.9 and so on until x0.5 y0.5 z0.5 when i press A and vice versa, so i can see the scale down and scale up when i play, if it’s even possible? If it’s possible that would be nice :slight_smile:

Edit: If anyone is reading this, please ignore the huge blueprint below, and check out the nicer one I made near the bottom of the page.

Notice how in your blueprint for shrinking, you’re setting the value to the current value - 1? If the current value is 1 it ends up 0. When the scale is 0 it is nothing, and this causes the camera to fall to the ground and half way through it.

Now, as for the smooth transition between sizes you requested, you need to use a tick event that keeps adjusting the size by tiny increments until it reaches it’s target size.

I’ll show you a blueprint I made, but first let me explain exactly what it does: It allows you to use 2 buttons to switch between just 3 precise sizes: small, medium, and large. The transition between sizes is not instant, you can see a smooth grow/shrink.

(Note: The “get max element” node I’m using returns the highest float in the vector. But in this case, the values of x, y, and z are all the same. The only reason I do this is because you cannot compare two vectors to see which is greater. I needed to use a float. If you plan on making the values of x, y, and z be different, you will have to find another way to check the values. Let me know if you need any help with that.)

For this blueprint, I created 3 variables. The one called “normal size” has a default value of true. (For the inputs, I’m using d-pad directions, but you can use A and E of course.) (Sorry the nodes are so compacted, I wanted to fit them all in frame. Just pay close attention to where the wires are going. ^^;

Oh wow that’s a good explanation. Thanks for the info, i will try this and if i have more questions i will let you know.

Ok i have completely done the blueprint, the only thing is that the ball gets larger than the default x1 y1 z1, i fixed this by setting the upper is “less than” node to 1 instead of 2. The second thing i changed is the upper completely right scale actor from x2 y2 z2 to x1 y1 z1. This fixed the way to large ball. Thank you for this blueprint so far :slight_smile:

Another problem i’m having. When i’m not moving and when i’m on the smallest ball scale and then press E the ball scales up but the ball is not fully on the map. I have a screenshot to show you what i mean ( the first screenshot ). How can i fix that so the ball will be on the map? Like the second screenshot.

Thanks in advance

I don’t know. :confused: Have you found any info on this yet? (Sorry for late replay.)

This “in the floor” thing wasn’t happening to me. However, I just added my scale blueprint to a couple different actors in my game, and now this glitch has affected one of them. (But not the others.) To help narrow down the problem though, I made a super simple scale blueprint here: But it has the exact same problem.

138189-ue4-screenshot19.jpg

Upon closer inspection, I think the problem is the collision shape is not scaling along with the mesh for some reason. Because the mesh also goes partially through the walls and everything else.

I have know idea what’s causing this. I’ve been trying to find a fix, but have had no success so far. I’m pretty busy with other things right now, so you might want to post this problem as a separate question. (You should post the simple scale blueprint above. (Posting the complicated one will overwhelm the people hoping to answer, lol.))

So about it scaling too big: I designed it that way on purpose, as I missed the part where you said you didn’t want the scale to go over 1. I’m so sorry about that. ^^;

Hi Jericho, Thanks for the reply.

No i havent found anything on the internet for this problem. Don’t worry about the x2 y2 z2 scaling thing, i fixed that on my own :slight_smile:

Weird that this did affect one of them, if it works with the others then it should work with that one too. I will try to do this with another character or new project and try it out.

I think i know how to fix the collision thingy. Maybe in the character blueprint i need to put the ball on the collision or vise verca, that way when we scale the ball it gets no errors or glitches. I have not tryed this yet i’m just thinking out loud :slight_smile:

Or create an event on the collision shape. I don’t know how i could fix this. I will try some things and reply back when i know more about this.

It could also be a blueprint somewhere that is “colliding” with the blueprint you are working on, i don’t know just a thought.

I will reply back when i know more.

Hmm Weird, i have made a new project and i can’t get it to work. I get the following error:

Error Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue4 from function: ‘ExecuteUbergraph_PhysicsBallBP’ from node: Branch in graph: EventGraph in object: PhysicsBallBP with description: Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue4

I have copied the physics ball of the rolling template and made some changes to it but it should work. If you want to see the blueprint i can always upload the blueprint.

The only thing that is not working are the branch nodes. If anyone knows how to fix this please share the info ( some blueprint screenshots would be nice also )

Thanks in advance

)

I wanted to add this blueprint too, maybe there’s a problem with this one. I don’t think there’s a problem, it’s identical to Jericho’s blueprint. If you know a better way to scale your character as mentioned above please let me know.

Thanks in advance for helping me.

The “get player character” isn’t working because the physics ball actually isn’t of a character class. It is a pawn class, so try using “get player pawn” instead. : )

Thanks for the reply. The player pawn helped :slight_smile: but only for the scale down, not for the scale up.

Another thing i have issues with is when i press A it does not scale down directly, i need to press A again and then the ball scales down. Any idea’s what the problem could be?

I also needed to change the A and E inputs, i was scaling down with the E button instead of the A button.

Oh my god nevermind, i did not check the set grow in the first blueprint :slight_smile:
I can now scale the ball down and up, but i still have to press the A button 2 times to get a scale down effect. Any idea on how to fix that?

Also, the ball is not going “under the map” annymore :slight_smile:

When i pressed A button 2 times, after that i can scale up/down, up/down Without any problems. It’s just the first A button press that’s not responding for some reason.

Thanks for accepting my answer!

Well, I never did figure out what was causing the “in the floor” thing.

But I thought I’d come back and show off my new blueprint for scaling, it works pretty much the same as the complicated one above, but it looks a whole lot nicer!

Just look at how neat it is! (The big blueprint I made before is an embarrassment. ^^;)
I really wish I knew about “interps” sooner! They are the key to getting smooth transitions.