Hi I am using UE 4.26 and recently I developed a fall damage system using velocity from Z vector however I also made a dash ability which also uses velocity and because the velocity builds up when I use the dash ability my character dies because I presume the game would think I fell from a high place and cause my player to die. I was wondering is there another way around this and if not could fall damage be done without using velocity? Here are some screenshots of the
blueprint, and thank you!
I am not sure about what exactly is âDash actionâ, but you can simply set Z component of Vector to zero after multiplying by 9000 in Dash Action InputâŚ
i think you could prevent dashing dead by making character status value and set in dashing
and during dashing check character status and block fall system affect to character.
for avoid unintended situation, need more condition though
- What Kehel18 said
- Wouldnât it be easier to:
Rather than Tick cascading branches, you could sample a curve when you land.
- here, fall velocity between 0-700 deals 0 damage
- falling with 1600 deals 121 damage
A single event, no tick, no blueprint spaghetti, easily adjustable curve, no typing values, little room for errors.
Consider it.
I will consider what Kehel18 said and I will try what Everynone did.
Thank you for all your help, this helped me out a lot and tbh I thought my code was the best it could be but thanks to Everynone I guess I can improve that code even more.
Awesome and very simple solution! Thank you very much!
This seems to be the best solution, however by the time I go to apply the damage to the character upon landing, my character is no longer falling, so it just registers as zero again. Do you know the best way to get the last known velocity without using the character movement? (I am developing for a physics based VR game and so character movement velocity always just returns 0âs)
get the last known velocity without using the character movement
How do you move the player in this VR?
a physics based VR
Is there a component on the character that simulates physics? You could get velocity from the physics body instead of the CMC.
Worst case scenario, store the last frameâs velocity manually.
Hey, thanks for the quick answer! So I bought this physics VR kit from the UE store, so im not 100% sure how to see, all I can tell is that its physics based, and does not utilize the character movement at all (everything comes back as 0s and it doesnt tell me if the character is falling and other things like that, which is how I know it doesnt use the character movement)
BUT Get Pawn Velocity is how I have been getting the World Velocity of the Z axis for this to work. it works beautifully, but the moment I land, it looks for the fall damage, and is now set to zero because I am no longer falling. I hope that cleared stuff up somewhat, if not I can provide screenshots and other things right now
to add to that, I just saw that the velocity is calculated from a âBP_VRPhysicsPawn_PhysicsRigâ which doesnt have character movement at all, it seems to use an invisible sphere with torque for its locomotion.
Perhaps you could show the component hierarchy of the pawn?
One Final Update!!! I solved it!
What I did, was:
during the tick that would update the last known velocity, I set it as a variable âCurrent Player Velocityâ and before it could tick again, the next tick that happened would recall what the âCurrent Player Velocityâ was set to, instead of looking again to see what the velocity is!