Could I get some help with this hookshot function?
I've been working on a function that takes in where you're looking and moves you in that direction, like a hookshot, which uses the third person code as a start. I think I have a good start here but in editor it does nothing.
code in sCharacter.cpp
This all compiles btw.
First of I'm not sure how to get FRotaionMatrix(MyRotation) to get X,Y and Z instead of just X, and plugged X in just to see if it works, it doesn't. I have set the function name in the editor project input settings to activate when left click is pressed.
First off, you won't be able to move vertically via AddMovementInput while your movement mode is "Falling" and lateral movement will be limited by your air control values. Setting the movement mode to "Flying" will allow you to do this, but it will also disable gravity which may or may not be acceptable. As Redshft mentioned, you can set the velocity directly as well, but that will not work in a networked environment since you'll be working around the input system. This may or may not be acceptable. If you need more specific behavior then you can create a custom movement mode in your movement component.
As far as your rotation issue goes, I think what you're probably looking for is
answered Sep 14 '17 at 06:53 PM
I believe the function APawn::AddMovementInput is used purely for ground movement. You would need to do something similar to the jump code in ACharacter and UCharacterMovementComponent in order for your character to move through the air. In other words, you'd have to set the movement mode to falling and set the velocity directly.
answered May 19 '14 at 03:11 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here