Using the Blueprint first person starter, I’d like to add a physics impulse to the character on damage.
I can’t seem to get any physics working on the character. If I enable ‘simulate physics’ on the character capsule, it simply falls through the floor.
The simplest test I could conceive was to add a key press connected to a add impulse in the MyCharacter blueprint, with the target actor being the character capsule. No movement. Seems like I’m missing something simple and obvious.
I would also like to know the answer to this. It’s not some overly complicated concept, it must be possible…
Have you tried creating a character blueprint? When you create a new blueprint the window pops up and choose character(iirc).
Once you have that made, I it should come preloaded with quite a few defaults you can play with that may include physics.
I’ll hijack this thread and say I have a Character blueprint but it doesn’t seem like any physics-related settings work at all.
I do something similar by adding a vector to the velocity of the character movement component. Just get the current velocity from the character movement component, add or subtract some vector and then set it again.
What are your settings for collision on the Character Capsule? Try setting it to a Physics Actor and that both Simulate Physics and Use CCD are checked.
With this, I was able to use the First Person template and fire projectiles at the capsule which generated an impulse.
Does this stop the original character movement? I have attempted to reproduce this but the character doesn’t respond to any input anymore.
Built the blueprint first person. Selected the capsule component, enable physics, enable collision, enable CCD.
The character responds to left/right movement, but can not move forward or jump.
Thanks Eckhard, that seems like it should work for what I need.
How are you setting the movement? I’ve tried ‘Add Movement Input’ and ‘Add Input Vector’ triggered off a keypress, but it doesn’t update.
I’ve gotten ‘Launch Character’ respond, but I’d like to have the motion be more abrupt, where the character lurches back on impact.
I’m using AddMovementInput as well and it is working well for me. This might be a wild guess but are you taking the controller rotation into account when calculating the input vector? If so, is you controller pitched in a way that it faces the ground?
If this is your problem you might want to only use the Yaw from the controller rotation. Also you should forget to normalize the direction vector before passing it into AddMovementInput.
As a sidenote. If my first post already answered the initial question, please be so kind and mark the post as answered
I’ve investigated a couple approaches here. Using AddMovementInput doesn’t work. There seem to be some mechanism related to the update tick where movement is accumulated. I’d assumed that the scale value on AddMovement would allow values 1+ but it’s only 0-1. Triggering off a single event doesn’t work, but hooking it to EventTick or an input binding lets you see the behavior.
I’m not sure of the relative merits of velocity vs launch.
I wanted to work a bit with trying to get physics to work on the first person pawn. I selected the character capsule component and changed the collision preset from pawn to custom and collision enabled to keep it from falling through the floor. This should hopefully work with radial forces as well.
For others who may come across this thread, I also had some success with ‘Move Component To’, but the character would hang in space until the next input update.