Hello!
I have a problem which i cannot find the end. I have been searching for a response plenty of time and this thing bothers me a lot.No matter what i do I can not move up and down. I have change the gravity to all the things, try with some BP code; I have been searching on YT, google and I couldn’t fix it. Please help me, Kind regards Alex.
You can’t use movement input.
The character movement component is trying to move you towards that vector within the level / collision system. It will always stay on the ground unless you walk over a ledge or jump.
For movement in the direction Z you have three options.
- Jump. Simple enough. There’s a function called “Jump” and it will make you jump up a bit.
- Launch / AddImpulse. This will make the character instantly get momentum in the provided direction. If you use up you can imagine it like an explosion right below the character.
- “SetActorLocation”. Take the current location, add a certain amount in Z direction and set your current actor location. This way you can move slowly upwards or in any way you want. You will have to do a small amount of vector math yourself though.
Cheers
Thanks for the fast response! It is possible to make it delayed like it’s not affected by the gravity?( after the key is presses it takes some time until stops)
Kind regards, Alex.
If you get the “Character Movement Component”, pull out a wire you can modify the gravity scale (how much the character is affected by gravity).
Setting it to 0 will make your character unaffected by gravity.
This can be done anytime so you can use whatever is most convenient to you to set up a time limit or interpolate the float from your default value to 0 to get a smoothed effect.
Delta Time, Timelines and delays all work well to set up timed events.
Thanks a lot! Now i can fly! However I still got one question: I’ve tried using delays and delta time but i can’t get a smooth stop. So I inherit a speed and when the space is released I want that speed to reach 0 over time (like 2 seconds). Can you give me some ideeas?
Have you seen Timelines yet?
That looks like it might be the right tool for this job.
Even though this is a late answer, it’s a fix for the problem within the player blueprints. If you have a spring arm component in your player blueprint, then:
- Open the player blueprint
- Click on the spring arm component
- In the Details Section go to Camera Settings and make sure “Use Pawn Control Rotation” is checked.
Your look up and down should now work. This is if you have moved it from base character, etc