Preamble:
Hey guys!So, I’m trying to make a BP script to make a character that is able to transform into other characters (with different sizes, move speeds, etc.)
First, I tried to do this by unpossessing and destructing the current actor and then spawning another actor in the same place and possessing it. But whatever I did, it would not maintain the camera pitch.
Then, I decided to use just one Character Blueprint, and change it’s Skeletal Mesh, Animation BP, Camera Boom, and NavMovement Component properties during Gameplay. Everything was awesome, until I had to scale the Character Capsule Component, to scale the characters up and down.
The Main Problem:
When I have a character with, let's say, 1 in Z-Scale, and I scale it down to 0.1, the character floats and then lands. But the main problem (stated in the title) is that when I have a character that has 0.1 in Z-Scale, and scales it up to 1 back again, the character either stucks into the floor, or it falls beneath it.Theory:
Actually, what is happening is that when we scale the Capsule Component, it scales with the pivot point in the center of the capsule. Thus, when we have a small capsule touching it's bottom in the floor, when we scale it up, the feet falls below the floor (and when we scale it down, the feet goes above the floor) and the character falls.Questions:
- Any ideas of how could this be solved?
- Is there any way to change the Capsule Component Pivot Point to the bottom, so it scales in direction to the toes, instead of in direction to the center of the character?
- A not so elegant solution: check if the character is below the floor after transformation and if it is, bring it up. How to do it?
- Is there any other solution that I'm not thinking about?
PS: If you need my Blueprint of what I’ve achieved so far, let me know! =]
P-PS: If you have any solutions that are not related to Blueprints (such as a C++ implementation), please, share it also! I have no problem understanding C++. I posted in the Blueprint section just because I’m already using Blueprints. =P
P-P-PS: It’s never too late to answer! I’ll be working with other stuff while I do not manage to solve it, so feel free to answer it even if it’s been over a month (of course, when it’s solved, I will post it back here!).
Thanks!!