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