x

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"

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 :-)

Any help is welcome,

Peace

alt text

Product Version: UE 4.14
Tags:
more ▼

asked May 15 '17 at 07:08 PM in Blueprint Scripting

avatar image

gandalfini25
20 9 8 10

avatar image gandalfini25 May 15 '17 at 07:34 PM

I wanted to add something more, sorry for this :-)

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 :-)

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

1 answer: sort voted first

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. ^^; alt text

alt text

more ▼

answered May 16 '17 at 04:42 AM

avatar image

JerichoBLT
184 14 20 30

avatar image gandalfini25 May 16 '17 at 07:30 AM

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.

avatar image gandalfini25 May 16 '17 at 02:33 PM

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 :-)

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

alt text

alt text

ball not on map.png (990.4 kB)
ball on map.png (1.1 MB)
avatar image JerichoBLT May 19 '17 at 05:04 AM

I don't know. :/ 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. ![alt text][1] 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. ^^; [1]: /storage/temp/138457-ue4-screenshot19.jpg

avatar image gandalfini25 May 19 '17 at 07:52 AM

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 :-)

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 :-)

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.

avatar image gandalfini25 May 21 '17 at 09:17 PM

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

alt text)

avatar image gandalfini25 May 21 '17 at 09:33 PM

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.

alt text

avatar image JerichoBLT May 23 '17 at 03:47 PM

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. : )

avatar image gandalfini25 May 23 '17 at 08:12 PM

Thanks for the reply. The player pawn helped :-) 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.

avatar image gandalfini25 May 23 '17 at 08:21 PM

Oh my god nevermind, i did not check the set grow in the first blueprint :-) 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?

avatar image gandalfini25 May 23 '17 at 08:27 PM

Also, the ball is not going "under the map" annymore :-)

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.

avatar image JerichoBLT Jun 23 '17 at 02:10 AM

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!

alt text

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.

(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