I would like to add a damage system. The idea is simple, if you hit a wall with speed greater than x you get damaged. This BP is based on pawn , I know that the Character BP has “Get current acceleration” Anyway…
Physics time…
As far as I am familiar with physics My idea needs an acceleration value ( I am going to ignore the mass of the objects and the contact area for simplicity ).
When the Abs value of the Acceleration is greater than some number we are going to damage the player.
The problem is that I don’t know how to get the t1 t2 v1 and v2 in BP
I can get some vars from the beginning of the the button press but in this case when the floor collapses and the player has not pressed a button (he may but we are not sure) we won’t get fall damage.
Additional thoughts:
I can damage the player if he exceeds a certain amount of speed but this doesn’t work for simulating a person.
Post ideas:)
you want to add a damage sistem.
to damage the player if speed is greater than X.
Why do you need an acceleration value?
When the accelleration is greater than something does not mean that the pawn have a certain speed.
You can have 100 accelleration and 1 speed,
What are T1 T2 V1 V2 ?
Floor Collapse?
If you can damage the player at certain speed , what are you asking?
You can get the velocity of an object by calculating v = s/t = (s2-s1)/(t2-t1) where s2 and s1 are the actor’s locations at times t2 and t1. Maybe you want to make this in the tick-event and use deltaseconds and save the velocity in a variable, so you have at every time in the game the velocity of the actor.
The acceleration is a = v/t = (v2-v1)/(t2-t1). You will need to get the old velocity (v1) and the calculated new velocity (v2) to calculate acceleration.