I'm working on a game in which the player runs around a level themed as a pinball machine. There are flippers that react to the presence of pinballs by flipping (as one would expect pinball flippers to do). The problem that I'm having is that if the player is in the path of the flipper as it rotates, the player is instantly killed. The desired behavior is that the player is damaged and pushed away from the moving flipper.
I've tried all sorts of things to make this stop happening. Currently, in the flipper, I have the following code to handle the collision:
event Bump(Actor other, PrimitiveComponent otherComp, Object.Vector hitNormal)
{
local vector pushVelocity;
if(/*If Flipper is moving and is bump()ing the Player*/)
{
pushVelocity = hitNormal * CalcLinearVelocity(vsize(location - other.location));
player.TakeDamage(playerDamage, none, player.Location, pushVelocity * 2.1f, class'DamageType', , self);
}
}
By using all sorts of logging, I can determine that the code in question is being called when the flipper hits the player and the player is being killed on the first frame this collision occurs--logging within the if() block only appears once. And yes, playerDamage
is a value low enough that it would take many hits to kill the player.
Does anyone have any insight as to why the player is immediately dying instead of being damaged and pushed away? Or what sorts of things I should try to get my intended behavior?