nm, I got it. Some strange stuff I'm doing though, I don't know if it's the best way to do this. In the TakeDamage function:
Code:
function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector Momentum, class<DamageType> damageType) { local vector DirectionalHit, DirectionalFraction; local float RotationalYaw; DirectionalHit = ((HitLocation - Location) dot vector(Rotation)) * vector(Rotation); RotationalYaw = rotator(DirectionalHit).Yaw; RotationalYaw -= 16384; // Head on collision = 0, collision from direct left = 16384, direct right = -16384. RotationalYaw /= 182; // Approximate conversion to 360 degree scale. DirectionalFraction.X = cos(RotationalYaw); // Gives me fractional values for each direction, which I can DirectionalFraction.Y = sin(RotationalYaw); // multiply by the change in velocity to scale the magnitude of the hit. }
Comment